Cloning a read-write github repository using TortoiseHg
Asked Answered
A

5

15

I'm trying to clone my personal fork on github using the git+ssh protocol with TortoiseHg. It's giving me a rather strange error. Here is the command

hg clone git+ssh://[email protected]:myusername/thefork.git

This is after I have installed the hg-git module and it works just fine to clone using the git:// syntax. But I believe it's having trouble with the ssh. The error I'm getting is this.

importing Hg objects into Git
[Error 2] The system cannot find the file specified

I have tried adding manually the ssh command into the mercurial.ini file like this

[ui]
username = [email protected]
ssh="C:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 -i "C:\Source\SSHPrivateKey.ppk"

But I still get the same error. Any ideas?

Update 1

If I run the same command from the Git Bash shell it works just fine. I get this.

importing Hg objects into Git
Counting objects: 1559, done.
Compressing objects: 100% (586/586), done.
Total 1559 (delta 960), reused 1534 (delta 947)
importing Git objects into Hg
at:  0/86
updating to branch default
219 files updated, 0 files merged, 0 files removed, 0 files unresolved

I'm assuming it's because it can find ssh.exe and my key is already imported. I can add the path of ssh.exe to the windows command prompts path and then instead of the previous error I get this.

importing Hg objects into Git
Permission denied (publickey).
abort: the remote end hung up unexpectedly

It seems that it's looking specifically for ssh.exe eventhough I have specified the alternate ssh path in mercurial.ini. But my guess here is that that configuration is only for a ssh enabled mercurial server and doesn't apply to the hg-git plugin.

Almanza answered 4/4, 2010 at 4:31 Comment(1)
Note to self - be patient. Once I learned to wait the 5 minutes or so it can take to clone a very large repo, hg-git worked fine.Evadne
A
8

I have found a way around this but it's pretty hackish. I noticed that ProcessMonitor was showing it looking for ssh.exe in several different paths so I copied the TortoisePlink.exe in the TortoiseHg folder and named it ssh.exe.

copy "C:\Program Files\TortoiseHg\TortoisePlink.exe" "C:\Program Files\TortoiseHg\ssh.exe"

With just this change it will still fail the authentication. You'll get a pop-up box and this.

importing Hg objects into Git
abort: the remote end hung up unexpectedly

So you need to get a hold of pageant.exe that comes with the main PuTTy install. Start that up and add your key to it. Then run the clone command again and it should authenticate just fine.

Almanza answered 4/4, 2010 at 15:17 Comment(1)
The copy step is not necessary on my box. Just install putty-0.60-installer.exe from the link @Nathan provided, and then launch pageant.exe from Start menu. After that you can add your GitHub key to it.Ceilidh
A
2

After spending hours and hours trying to solve this, I've found one guide what explained it perfectly.

This is the URL: http://www.codeproject.com/Articles/376058/Step-by-step-Setup-TortoiseHg-for-gitHub

One thing not mentioned in the guide is that the 32-bit version of Pageant bundled with TortoiseHG cannot recognise the "git@" part in an url, and keeps asking for it. Downloading the 64-bit version of Pageant fixes this bug.

Download 64-bit Pageant: https://splunk.net/w/PuTTy64bit

I've opened a ticket for including 64-bit Pageant with TortoiseHG: https://bitbucket.org/tortoisehg/thg/issue/2145/bundle-64-bit-pageant-with-64-bit

Aileenailene answered 13/9, 2012 at 13:54 Comment(1)
This appears to be ok with THG v2.5.1. My Pageant is .x64 & I haven't touched it.Evadne
A
1

I found I had to launch Pageant and load my SSH key and then initially clone using the command-line e.g.:

hg clone git+ssh://[email protected]/<username>/<repo>.git

But from then on I could use TortoiseHg against GitHub (push and pull) just fine (although Pageant needs to be running for authentication to work).

Armes answered 29/6, 2011 at 19:40 Comment(0)
R
0

I'm using "plink.exe" and "pageant.exe" instead of "TortoisePlink.exe". "pageant.exe" provides the pass phrase automatically when "plink.exe" needs it.

Retinue answered 4/4, 2010 at 11:57 Comment(1)
What is the configuration you are using in mercurial.ini? I've tried plink.exe from the regular PuTTY distribution but I get the same error.Almanza
H
0

I solved this problem by copying TortoisePlink.exe to ssh.exe. Then I placed ssh.exe in my path. As long as pageant is running, that works for me.

Given that I needed ssh.exe in my path, I wonder if hggit even reads the ssh= line at all.

This is still hackish, but a little less hackish than @Nathan's technique (I'm not a fan of messing with files inside \Program Files)

Hindustani answered 10/2, 2011 at 22:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.