简体   繁体   中英

hg clone ssh://user@url fails on windows 7 (cygwin), but works on OS X

I tried to do hg to a remote server ( hg pull or hg push ). Failed on Windows, but succeeded in OS X. I used the same ssh private and public keys for Windows and OS X. Here are the details:

On Windows, I used cygwin, for which I also installed openssh. The private and public keys are inside .ssh folder of cygwin home ( /home/simo/.ssh ). When I did, say, hg clone ssh://simo@url in cygwin, a popup windows of title TortoisePLink appears and asks me to enter Password, which, I believe, means the passphrase of the ssh key. I entered, and it immediately asks me to enter it again and again (the same popup window). I double-checked the password, of course. If I keep entering the password 5 times, then it stops and says Too many authentication failures for simo and abort: no suitable response from remote hg! .

Ironically, if I don't use Cygwin, but use Command Prompt, I still run into the same issue. This may be the key to understand the issue, because I am not sure the ssh used in command prompt is the same as the ssh used in cygwin, and therefore the ssh key does not seem to matter in either case. First, I only stored the key for .ssh in cygwin, I ran into the problem. I tried command prompt (without copying the ssh keys to there), I also ran into the problem, so looks like the ssh key is not used at all during the hg . I then tried copying the key to the home dir of command prompt ( C:\\Users\\simo\\.ssh ), I also faced the same issue.

I copied the ssh keys to my Mac OS X, put them inside .ssh, and run. Everything works fine. Any idea why I failed on Windows with hg ssh? Could the problem is because if Cygwin? Because the ssh keys are not used/not found? and why the heck the popup window with title TortoisePLInk keeps asking me for password?

On Windows you can have two different formats for ssh keys:

  • if you use Cygwin and openssh the format is similar to Unix one
  • if you use PuTTY/Pageant (ssh agent) the format is different

So you have to choose which one you want to use. Note that you can "import" you Unix format keys into a Pageant agent, this should then work right out of the box with Tortoise.

But you can also configure in mercurial.ini to use the Cygwin ssh (see for instance this answer: https://stackoverflow.com/a/18973676/236726 )

Hope it'll help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM