I'm having some trouble using Git with cygwin.

"Could not create directory '/home/Craig/.ssh'. The authenticity of host 'github.com (' 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)? no Host key verification failed. fatal: The remote end hung up unexpectedly"

is being displayed whilst trying to connect to github using SSH. I've also tried using https:// as the remote path but to no success.

I'm running windows 7.

migrated from stackoverflow.com Dec 11 '12 at 0:23

This question came from our site for professional and enthusiast programmers.

  • 2
    This might need to be moved to superuser. – VoronoiPotato Dec 10 '12 at 13:14
  • 1
    " Are you sure you want to continue connecting (yes/no)? no Host key verification failed" There's a surprise. – barlop Dec 11 '12 at 0:26
  • I have typed yes, the no was just to get an example error message. (hint: it's the same one.) – Craig Cuthbertson Dec 12 '12 at 12:08

This worked for me!

First, locate the file called 'passwd' in your C:\path\to\cygwin\etc directory and open it with wordpad.

Second, replace the text
/cygdrive/c/Documents and Settings/YOUR_NAME

  • 2
    Yup, this is one possible problem: if you have changed the cygwin home folder to point to the Windows home, it is not enough to just set the HOME env variable. The /etc/passwd file must also be edited, in order to point to your actual home folder. Git seems to rely on that (instead of first checking the $HOME var). Also remember that, starting on Windows 7, your home folder will be on /cygdrive/c/Users/YOUR_NAME instead of /cygdrive/c/Documents and Settings/YOUR_NAME. – rsenna Apr 24 '14 at 14:22
  • I changed how Cygwin mounts the C drive so it's at /c/ instead of /cygdrive/c/ and I got the same issue as this question and this answer fixed it (of course, I changed it to /c/Users/YOUR_NAME because of what I just said and I am on Windows 7 (which has C:\Users instead of C:\Documents and Settings it'd seem.)) – Captain Man Oct 12 '15 at 19:21

maybe the permissions to your home directory are interfering with ssh's ability to create the known_hosts file?

go to your home directory and create a folder called .ssh, and a blank file called known_hosts inside of it. then set the permissions on the file to 644.

cd ~
mkdir .ssh
touch ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts

then try ssh again and see if the result is any different. (note: you'll have to say yes when asked if you want to continue connecting the first time. then that server will be added to the known_hosts list and you shouldn't be prompted anymore after that.)

  • .ssh already exists in my home directory, I have created and chmod'd the known_hosts file, but to no positive effect. My home dir is currently set as /cygdrive/c/Users/Craig, could this be the problem? – Craig Cuthbertson Dec 12 '12 at 12:03

Try typing yes when you are asked if you want to continue

  • I have done so. The 'no' was to reproduce the error message to post on here. – Craig Cuthbertson Dec 12 '12 at 12:08

In addition to answer by diannal, if you don't have a passwd file under etc folder in Cygwin root folder, then you can first create one by issuing this command: mkpasswd -l -p "$(cygpath -H)" > /etc/passwd

  • This did indeed create a passwd file, but sadly nowhere was I referencing home – Jamie Hutber Feb 22 '16 at 17:27

Use Sysinternals Process Monitor to log the file system accesses that take place when you are trying to do this.


In your Documents and Settings folder of your local machine, create the folder home\. For some reason, cwRsync won't create these folders for you. I didn't change my cygpath, so I created mine in C:\Program Files\cwRsync\home\.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.