This article was very useful, but to help people coming from Google, this error (Permission denied (publickey)) also happens if your identity is not set correctly.
When you do ssh_keygen it will generate a new SSH key, which the default name is id_rsa. If your computer happens to have another key already, with another name, your identity might be set to that key.
You should edit ~/.ssh/config, and make sure IdentityFile is set to the correct private key
This article was very useful, but to help people coming from Google, this error (Permission denied (publickey)) also happens if your identity is not set correctly.
When you do
ssh_keygen
it will generate a new SSH key, which the default name isid_rsa
. If your computer happens to have another key already, with another name, your identity might be set to that key.You should edit
~/.ssh/config
, and make sureIdentityFile
is set to the correct private keyI solved using this solutions
Thanks for the quick solution! If your on a mac you wanna make this edit here /private/etc/ssh/ssh_config
I lost my access to DigitalOcean,
this tip of yours was my salvation, change the file name to id_rsa
Thanks