Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSHing [email protected] shows wrong/old SSH key

k, so I was setting up Git and followed this tutorial to set up an SSH key. The fingerprint was 16:27:...:a6:48. I installed the GitHub client for Windows which set up a new SSH key automatically called github_rsa in the %user%/.ssh/ folder.

I deleted the "old" SSH key (don't ask me why) and set up a new one with the fingerprint a6:17:ed:4a:1d:9a:c7:63:6a:a1:38:8b:96:e3:91:bf I had simply deleted the previous id_rsa keys and the known_hosts file and then used ssh-keygen to make another - I didn't mess with the GitHub key).

Now, whenever I try to ssh into git@github, it says:

The authentication of host 'github.com (207.97.227.239)' can't be estabilished RSA key fingerprint is 16:27:...:a6:48 Are you sure you want to continue connecting (yes/no)?

which is NOT what I want. It's showing the old SSH key which I'd deleted (along with known_hosts). What do I do?

[Edit]: I was (wrongly) assuming that the fingerprint from the output of the terminal would match the fingerprint of my Public RSA key. I still have an issue with the SSH, but it's not related to this (the question has already been asked, read: Git push requires username and password). I'd delete this question, but it doesn't allow me to, saying "It has 1 or more answers. Please flag it for moderator attention." _even though its mine. Read more at: https://meta.stackexchange.com/questions/140646/what-should-i-do-if-i-realize-the-premise-of-a-question-was-faulty-but-i-alread/140676#140676

like image 376
Yatharth Agarwal Avatar asked Jul 19 '12 15:07

Yatharth Agarwal


2 Answers

I think you should edit your <USER>/.ssh/config file (or create it) with

Host github.com
User <USER>
IdentityFile ~/.ssh/github_rsa

Host *
User <USER>
IdentityFile ~/.ssh/id_rsa

and that would do the trick if what happens is what you're saying.

But maybe it is not a problem, as Step 5: Test everything out of your link says that you may see this warning:

# The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?

and you shouldn't worry, this is supposed to happen. Just verify that the fingerprint matches the one here and type "yes".

like image 97
Miguel Avatar answered Sep 30 '22 04:09

Miguel


Since you deleted your known_hosts file, ssh-agent will give this warning:

The authentication of host 'github.com (207.97.227.239)' can't be estabilished RSA key fingerprint is 16:27:...:a6:48 Are you sure you want to continue connecting (yes/no)?

the first time it tries to connect to this host as well as any other hosts you SSH into. For every new host you say 'yes', the host's fingerprint gets added into the known_hosts file.

If you DO get the warning every time, then you have a bigger issue that your known_hosts file is not being written by ssh or read back. You can verify if you're given this warning message each time you SSH into some other machine as well.

Further reading

like image 33
Tuxdude Avatar answered Sep 30 '22 06:09

Tuxdude