GitHub: Permission denied (publickey). fatal: The remote end hung up unexpectedly

Solution 1:

I had to add my public key to github. https://help.github.com/articles/generating-ssh-keys

Solution 2:

after you created the RSA key pair, you must to add it to SSH using:

ssh-add ~/.ssh/id_rsa

or wherever you created your rsa key pair.

Solution 3:

Yes, It's a public key Problem. I'm a windows user,and the page below help me resolve this problem.

http://help.github.com/win-set-up-git/

more precisely this link should be helpful

https://help.github.com/articles/error-permission-denied-publickey

Solution 4:

For me the problem was the execution of clone via sudo.

If you clone to a directory where you have user permission ( /home/user/git) it will work fine.

(Explanation: Running a command as superuser will not work with the same public key as running a command as user. Therefore Github refused the connection.)

This solution requires a SSH key already to be set up: https://help.github.com/articles/generating-ssh-keys