3

I'm having some trouble using Git with cygwin.

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

3
  • 2
    This might need to be moved to superuser. Dec 10, 2012 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, 2012 at 0:26
  • I have typed yes, the no was just to get an example error message. (hint: it's the same one.) Dec 12, 2012 at 12:08

6 Answers 6

6

This worked for me!
http://ekawas.blogspot.co.uk/2007/03/solving-pesky-ssh-issues-in-cygwin.html

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

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

2
  • 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, 2014 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.)) Oct 12, 2015 at 19:21
1

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.)

1
  • .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? Dec 12, 2012 at 12:03
1

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

1
  • I have done so. The 'no' was to reproduce the error message to post on here. Dec 12, 2012 at 12:08
1

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

1
  • This did indeed create a passwd file, but sadly nowhere was I referencing home Feb 22, 2016 at 17:27
0

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

0

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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