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

29,799

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"):

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

Share:
29,799
nonopolarity
Author by

nonopolarity

I started with Apple Basic and 6502 machine code and Assembly, then went onto Fortran, Pascal, C, Lisp (Scheme), microcode, Perl, Java, JavaScript, Python, Ruby, PHP, and Objective-C. Originally, I was going to go with an Atari... but it was a big expense for my family... and after months of me nagging, my dad agreed to buy an Apple ][. At that time, the Pineapple was also available. The few months in childhood seem to last forever. A few months nowadays seem to pass like days. Those days, a computer had 16kb or 48kb of RAM. Today, the computer has 16GB. So it is in fact a million times. If you know what D5 AA 96 means, we belong to the same era.

Updated on July 09, 2022

Comments

  • nonopolarity
    nonopolarity almost 2 years

    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?

  • nonopolarity
    nonopolarity about 14 years
    i see. thanks. i may add here that the "home directory" on Windows 7 is something like c:\users\peter
  • Apollon
    Apollon over 13 years
    Note that if you want to specify your username, that can be done with the -l switch for tortoiseplink (add "-l myusername" to this ssh-line)
  • David Martin
    David Martin over 11 years
    Thanks, this approach can also be used for CCnet build server, just put it in the service accounts home directory
  • david.s
    david.s over 11 years
    @HoangTran Use -pw password argument to login with the specified password.
  • Hoang Tran
    Hoang Tran over 11 years
    @david.s Thanks, but that means password is put in this plaintext .ini file, what I look for is a way to save it securely.
  • Josh Noe
    Josh Noe about 5 years
    Starting in TortoiseHg 3.5, tortoiseplink isn't added to the PATH by default, so you need to do ssh = "C:\Program Files\TortoiseHg\lib\tortoiseplink.exe" -ssh -i "C:\Users\UserName\mykey.ppk" instead
  • cham
    cham almost 4 years
    Also, you may not have tortiseplink.exe installed by default; that was the next prob for me.