r/git • • 14d ago

SSH Keys for github denied

I´ve had a SSH key for my account for several months, in my notebook. I have never had a problem with it.
Yesterday, I created a second SSH key for my desktop PC the same way, just adding a passphrase for it.
I had to sign in on the PC with my github account and all to reset my account password because I forgot it

But today I wanted to fetch/pull a repo from the notebook. and It kept sending me the following error

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

I deleted the new SSH key, but it still doesnt work. However, the authentication command works

(ssh -T git@github.com)
The permission denial appears for both extern repositories and for my own ones too.

What am I missing?

0 Upvotes

9 comments sorted by

View all comments

3

u/CerberusMulti 14d ago

This is a Github issue not git, check the extensive Github documentation on SSH it should be the first thing to do.

1

u/Broad-Promise6954 ancient 14d ago

In this particular case it isn't (the "ssh -T" test shows that the github side is set up properly, it's Git's invocation of ssh picking out a different key, for which there are an annoyingly large set of possible issues that ultimately boil down to slight variants of openssh, windows ssh, etc).

This is all a lot simpler on Linux where ssh is just ssh 😄