Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "The authenticity of host 'github.com' can't be established. RSA key fingerprint "

I use my project at work, but I would like to work with him from home as I can log into my home machine to work with my project.

However, from home, I see the following message:

The authenticity of host 'github.com (ip)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?

How can I get past it?

like image 630
emeeery Avatar asked Dec 08 '17 04:12

emeeery


3 Answers

You should simply be able to answer 'yes', which will update your ~/.ssh/known_hosts file.


A better approach, to avoid any MITM (Man-In-The-Middle) attack, would be (as commented below by Mamsds) to verify Github's public key first (see "GitHub's SSH key fingerprints") and, if you find a match, then you can answer 'yes'.

Example:

ssh-keyscan -t ecdsa github.com 2>&1 |ssh-keygen -lf -
256 SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM github.com (ECDSA)

After that, you can use a GitHub SSH URL (provided you have generated the SSH public/private keys, and registered the public one to your GitHub profile)

Note: the ssh key generation should use the base64 old PEM format (option -m PEM), rather than the new current 70 chars OpenSSH one.
See "What is the correct format for private key in Credentials":

ssh-keygen -m PEM -t rsa -P "" -f afile

That or you can switch to an HTTPS URL.

like image 125
VonC Avatar answered Oct 19 '22 17:10

VonC


As you are attempting to connect to Github using SSH for the first time (no existing entry for Github in ~/.ssh/known_hosts yet), you are being asked to verify the key fingerprint of the remote host. Because, if an intruder host represents itself as a Github server, it's RSA fingerprint will be different from that of a GitHub server fingerprint.

You have two options.

  1. You may just accept, considering you don't care about the authenticity of the remote host (Github in this case), or,

  2. You may verify that you are actually getting connected to a Github server, by matching the RSA fingerprint you are presented to (in the prompt), with GitHub's SSH key fingerprints in base64 format.

The latter option is usually more preferable.

like image 40
Shakil Avatar answered Oct 19 '22 19:10

Shakil


Just add Github fingerprint to known hosts this way:

ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
like image 10
Emmanuel Mahuni Avatar answered Oct 19 '22 19:10

Emmanuel Mahuni