11

I have used Puttygen to create a public and a private key, and I'm now ready to let TortoiseHg on Windows 7 do a clone by going to

ssh://[email protected]/somecode

but there seems to be no where to add the private key to TortoiseHg? (or even just the Mercurial command line)

The file is already some where on hard disk as somefile.ppk. Does someone know how to add it?

4 Answers 4

7

From the answer almost the same question at stackoverflow.com (by David Tischler):

Add the following to the [ui]-section of the mercurial.ini in your home directory:

[ui]
ssh = tortoiseplink.exe -ssh -i "C:\Users\UserName\mykey.ppk"

Or if you want to specify your ssh username, add

[ui]
ssh = tortoiseplink.exe -ssh -i "C:\Users\UserName\mykey.ppk" -l myusername

(assuming your key is in "C:\Users\UserName\mykey.ppk").

Pageant (already mentioned by others) should work also (even though I haven't tried it myself).

3
  • Does not work for me: remote: 'tortoiseplink.exe' is not recognized as an internal or external command, remote: operable program or batch file.
    – Zero3
    Jul 8, 2016 at 22:58
  • "if I give plink.exe the -ssh parameter, the saved PuTTY session is not used and therefore it doesn't use the correct port number. The -ssh parameter is unnecessary anyway, because SSH is the default protocol." -- mercurial-scm.org/wiki/AccessingSshRepositoriesFromWindows
    – David Cary
    Apr 18, 2017 at 13:20
  • @Zero3: After I installed TortoiseHg and PuTTY, I added this line to my "C:\Users\dc\mercurial.ini" file in the [ui] section: ssh = "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -i "C:\Users\dc\.ssh\github_rsa.ppk"
    – David Cary
    Apr 18, 2017 at 13:26
1

Looks like you need to run pageant.exe on the .ppk file generated by putty to register it in a place that hg can find it.

0

You don't add the key to TortoiseHg or to Mercurial. Instead, these programs will call Putty (via plink.ext, I think) and that program will need to know about the key.

It's been a while since I used Windows, but as I remember, Putty lets you save your settings under a profile name. That includes the username, hostname, and private key to use. If you create a profile called foo, then cloning from ssh://foo/ should work.

0

you should edit hgrc.d/Mercurial.rc

simple search for line with

ssh = "TortoisePlink.exe" -ssh -2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .