Erel Segal-Halevi
Erel Segal-Halevi

Reputation: 36715

How do I know which ssh key is used in my github account?

When I go to the SSH keys page in my GitHub account, I see a key whose identity starts with "c5:42:08:9d:39:22..."

On my computer, in the ".ssh" folder, I have several files that look like public SSH keys, but none of them contains a string similar to the above. For example, one of the files "id_rsa.pub" contains a string that starts with "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA..." there are other similar files that probably represent different keys.

How can I identify which of the files, if any, represents the actual key that is in my github account?

Upvotes: 26

Views: 6236

Answers (1)

Chris
Chris

Reputation: 136900

"c5:42:08:9d:39:22..." isn't the key, but rather the key's fingerprint. You can see your key's fingerprint using ssh-keygen:

ssh-keygen -lf ~/.ssh/id_rsa

Where

  • -l means we want to see the key's fingerprint
  • -f ~/.ssh/id_rsa is a path to the key whose fingerprint we want to see

On older versions of OpenSSH, you may need to also specify that you want the SHA256 fingerprint rather than another hash like MD5, since SHA256 is what GitHub shows in its web interface:

ssh-keygen -lf ~/.ssh/id_rsa -E sha256

You should get the same fingerprint from the public part as from the private part of the keypair.

Upvotes: 42

Related Questions