Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH cannot authenticate to [email protected]

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

like image 358
Phương Nguyễn Avatar asked Jan 23 '10 07:01

Phương Nguyễn


People also ask

How do I authenticate git GitHub?

Install GitHub CLI on macOS, Windows, or Linux. In the command line, enter gh auth login , then follow the prompts. When prompted for your preferred protocol for Git operations, select HTTPS . When asked if you would like to authenticate to Git with your GitHub credentials, enter Y .

Why is GitHub authentication failing?

Use your username as usual. Usually, the “Authentication Failed” error happens if you recently enabled 2-Factor Authentication on your GitHub account and uses HTTPS to push/pull in Git at the same time. GitHub deprecates the password authentication method from August 13, 2021 to favor more secure way of authentication.


2 Answers

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

like image 60
hailor Avatar answered Sep 22 '22 03:09

hailor


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).

like image 26
Phil Wallach Avatar answered Sep 23 '22 03:09

Phil Wallach