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://somebody@code.somewhere.com/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?

Martin Geisler
  • 1,271
  • 9
  • 23
nonopolarity
  • 535
  • 3
  • 6
  • 17

4 Answers4

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

Touko
  • 241
  • 3
  • 7
  • 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 08 '16 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." -- https://www.mercurial-scm.org/wiki/AccessingSshRepositoriesFromWindows – David Cary Apr 18 '17 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 '17 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.

Martin Geisler
  • 1,271
  • 9
  • 23
0

you should edit hgrc.d/Mercurial.rc

simple search for line with

ssh = "TortoisePlink.exe" -ssh -2