32

Recently, I sign up for a free plan on Github.com. I follow their instructions to generate a ssh key to add to my account. However, when I try ssh -v [email protected], I get this error:

debug1: Server accepts key: pkalg ssh-rsa blen 277
Agent admitted failure to sign using the key.
debug1: Trying private key: /home/phuongnd08/.ssh/identity
debug1: Trying private key: /home/phuongnd08/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

When I look into the error, I see a funny thing here, that is the .ssh/id_rsa was not tried, just .ssh/identity and .ssh/id_dsa were tried.

How can I fix this error? Thanks

3
  • Check the file permissions on your key. If they are too liberal it may be refusing to use the key. Make sure they only have perssion for you (0700). Commented Jan 23, 2010 at 7:57
  • Thanks a lot, that solved the problems. Why don't you post your word as an answer? Commented Jan 23, 2010 at 8:41
  • Made my comment an answer. Glad it helped. Commented Jan 28, 2010 at 11:17

5 Answers 5

137

You can use ssh-add ~/.ssh/id_rsa to fix this.

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks for the help, @hailor. This was giving me quite a bit of trouble.
This worked but I have no idea what I just did, can someone explain his?
I anyone is still curious, here's an explanation of what ssh-add does: askubuntu.com/a/137167/14564
worked for me as well, and thanks Sergey for the additional info regarding ssh-add!
This just have happened to me when there was a previous key in the .ssh/ folder. It should be included in the instructions of github when you backup a previous ssh key...
|
12

Check the file permissions on your key. If they are too liberal it may be refusing to use the key. Make sure they only have perssion for you (0700).

1 Comment

Executing ssh-add ~/.ssh/id_rsa essentially changes the file permission on id_rsa to 700 (by giving the authentication agent a private key identity). Refer the man page.
8

After trying all these answers with no luck, the following command solved it for me:

unset SSH_AUTH_SOCK

1 Comment

It seems like there is a problem with the ssh that it uses gui to ask and then store the passwords in memory, there is probably bug that if the password for the key is not present it will wait for the input but the input is not prompted to the user.
1

If it doesn't already exist, you generate the ssh key first:

ssh-keygen -t rsa 

now copy this key, it'll be in this dir ~/.ssh/id_rsa.pub, open with notepad, paste this key in the "add ssh key" section in your github account! That's it!

Comments

0

If you're using Github enterprise (Self hosting) it would be worth checking to see if the site is reachable. Applies to Github also.

Ran into the same issue in Intellij and when I went to check if the RSA public key was saved in my profile I found out the site returned a server error.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.