Joel Heuer
Joel Heuer

Reputation: 1

Update SSH key/RSA fingerprint for GitHub (Ubuntu-20.04) not working

My GitHub ssh key is expired. I tried to update it, which works on GitHub's site, but my laptop just shows me the old RSA fingerprint when I try to push/pull/clone. So currently, my laptop has no access to GitHub now.

There a similar questions on StackOverflow (but they are not covering my case):

When I try to push/pull, following message appears

The authenticity of host 'github.com (140.82.121.4)' can't be established.

RSA key fingerprint is SHA256:xyz/0GFYZ+xPpuxU.

Are you sure you want to continue connecting (yes/no/[fingerprint])?

Hitting yes results in having no access, because the fingerprint mentioned in the message is expired. Entering a new fingerprint seems not to work, because the message just appears again.

For sure, I tried to update the ssh key. Undertaken steps:

  1. deleted the old ssh key on GitHub (Settings --> SSH and GPG keys --> [Ðelete] old key)
  2. created a new ssh key in my terminal with ssh-keygen -o
  3. ~/.ssh/id_rsa and ~/.ssh/id_rsa were updated
  4. got my fingerprint, let's say SHA265:abcdefg name@name-P452USF
  5. saved the ssh key on GitHub.
  6. message appears again after trying to pull/clone/push. Again the message shows the expired fingerprint
  7. deleted content of ~/.ssh/known_host, because the expired fingerprint is stored here.
  8. repeated steps 1-5
  9. message occurs again (why/where is expired fingerprint still stored???)

Rebooting my device does not work too.

Entering the new fingerprint does not work (why?). After hitting [Enter] the message appears again.

Upvotes: 0

Views: 1623

Answers (1)

Isikyus
Isikyus

Reputation: 73

deleted content of ~/.ssh/known_host, because the expired fingerprint is stored here.

This should usually work (though on my computer the filename is ~/.ssh/known_hosts with an s).

However, per the SSH man page there is also a system-wide config file with known host keys:

 /etc/ssh/ssh_known_hosts
        Systemwide list of known host keys.  This file should be prepared by the system
        administrator to contain the public host keys of all machines in the organization.
        It should be world-readable.  See sshd(8) for further details of the format of this
        file.

If you remove the expired fingerprint from that file as well, does it work?

This command should remove just that fingerprint without affecting other known hosts in the file:

sudo ssh-keygen -f "/etc/ssh/ssh_known_hosts" -R github.com

Upvotes: 1

Related Questions