Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git on Cygwin: Fails to add the host to the list of known hosts

Tags:

git

ssh

cygwin

I'm using cygwin git on windows 7 and everytime I do any operation that requires communication with github via SSH, I get the following message:

Could not create directory '/home/ltb/.ssh'.
The authenticity of host 'github.com (192.30.252.129)' 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)?

So far so good, I understand what's going on above. But once I enter yes, SSH should be able to insert the github key in the known_hosts file and move. Instead I get the following error message everytime:

Failed to add the host to the list of known hosts (/home/ltb/.ssh/known_hosts).

What am I doing wrong?

like image 751
Leo Bontemps Avatar asked Sep 06 '14 19:09

Leo Bontemps


1 Answers

I wrote a blog post about this very problem. The solution lies in the fact that your home folder in cygwin is most likely under /cygdrive/c/home/ltb/ and NOT under /home/ltb/ as you listed above. You can fix it like this:

  1. Locate the passwd file, which is usually at C:\cygwin\etc\
  2. Open it with your prefered editor
  3. On the line that starts with your username, change the section that reads /home/<user> to read /cygdrive/c/home/<user> where <user> is your cygwin username. Adjust this path accordingly if different.
  4. Save the changes and restart the Cygwin Terminal

Hope this helps...

like image 178
λ Jonas Gorauskas Avatar answered Nov 02 '22 01:11

λ Jonas Gorauskas