I was trying to push to Github and got the following error:
debug1: No more authentication methods to try.
Permission denied (publickey).
In the above case make sure a new SSH key exists by checking there are files in ~/.ssh commonly named id_rsa and id_rsa.pub.
If not run:
ssh-keygen -t rsa -C "email@domain.com"
Replace the email address with your email address. Follow the on screen prompts.
Add the newly generated key:
ssh-add ~/.ssh/id_rsa
Run the following command to test the SSH Github connection:
ssh -T git@github.com
If the above doesn’t work check the pub key has been added on Github. This can be found in the settings page and paste the exact contents in ~/.ssh/id_rsa.pub
Error: Permission denied (publickey)