nonopolarity
nonopolarity

Reputation: 150956

How to let TortoiseHg (Mercurial) on Windows use the Private Key file generated (by Puttygen)?

I have used Puttygen to create a public and a private key, and then is 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?

Upvotes: 60

Views: 31394

Answers (2)

David Tischler
David Tischler

Reputation: 2682

Either add the following to the [ui] section of the mercurial.ini in your home directory (assuming your key is in "C:\Users\UserName\mykey.ppk"):

TortoiseHg 3.5 and newer (thanks to Josh Noe for pointing out in the comments that tortoiseplink.exe is no longer added to the PATH by default):

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

Older versions of TortoiseHg (or if you have tortoiseplink.exe on your PATH):

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

or use Pageant, found in the TortoiseHg installation path (e.g. C:\Program Files\TortoiseHg\Pageant.exe). Start it, double click the taskbar icon that appears, and add the .ppk-file.

Upvotes: 87

user1198289
user1198289

Reputation: 657

need an ssh key generator first

  1. cmd: ssh-keygen -t rsa
  2. open PuTTY Key Generator
  3. Conversions > import key: open the id_rsa file in C:\Users\.ssh (you may have to create the folder !must run cmd as Admin!)
  4. Save the imported file id_rsa as id_rsa.ppk
  5. Open Pageant.exe in TortoiseHG folder
  6. It will show up in Taskbar
  7. Right click and click add keys
  8. Finally add your new ppk file

Oh right copy the contents of id_rsa.pub to hg host

Upvotes: 2

Related Questions