vitalyliber / dokku-github-action

Deploy applications to Dokku
https://vitalyliber.com/courses/deploj-prilozhenij-s-dokku
MIT License
78 stars 32 forks source link

Problem with my private key #11

Closed vitor-amartins closed 4 years ago

vitor-amartins commented 4 years ago

Hello everyone, I'm trying to use this action, but I a bit confused with the SSH key that I should put on my repository secrets.

I tried to put the ssh of my computer, but I got this when running the action: Error loading key "/github/home/.ssh/deploy_key": invalid format

Could you instruct me of what's the correct format and how can I generate it?

WilliamMayor commented 4 years ago

Your SSH key should be the private half of an SSH key that can be used to deploy to Dokku.

When you first set up Dokku you had to copy paste an SSH key into the web-installer process? That was the public key, you now need the private key.

If you're using a unix system (e.g. MacOS, Linux etc.) and you have an SSH called id_rsa then open up your terminal and something like this should work:

cat ~/.ssh/id_rsa

Then copy that result and paste it into your GitHub secrets page. (You could even run cat ~/.ssh/id_rsa | pbcopy to have the key copied into your clipboard straightaway.)

Remember that as well as adding the key to your GitHub secrets you need to tell the action where it is. So you'll need to add something like PRIVATE_KEY= ${{ secrets.SSH_KEY }} to your workflow's env. (You'll need to change SSH_KEY to whatever you called your secrets).

vitor-amartins commented 4 years ago

Thanks a lot for your answer! I've followed your instructions and it worked perfectly!