Git: SSH connection not working. Permission denied (publickey)

Viewed 56

My git SSH connection is not working. However, I've generated an SSH-key, added it to my GitHub account and the ssh -T git@github.com is showing success.

However, the ssh -T *username*@github.com command is not working. I think this is what is causing the permission error on the git pull action I'm trying to perform.

How can I fix this?

1 Answers

ssh -T *username*@github.com works only with real SSH servers, not Git hostings. For SSH at Git hostings always use username git. The real username at Git hostings must be used with HTTPS but not SSH.

So fix your URL:

git remote set-url origin git@github.com:USER/REPO.git

and pull/push.

Related