Mercurial, MercurialEclipse, TortoiseHg and SSH Server with Win7

There is problem with the Usercredentials passed by MercurialEclipse to a remote SSH repository. There are two ways to fix this issue, one is to authenticate with a public/private keypair and the use of TortoisePlink/PuttyPlink, the other way is to install openSSh on the Windows machine with cygwin and the openSSH package.

I decided to use the public/private Key authentication with Plink because it’s more comfortable in conjunction with Pageant because you only need to give your password only once, despite if youre using Tortoise or Eclipse. Here is the HowTo:

1. Set up the public/private key authentication as described in the Post here.

### To get TortoiseHg working: ###
2. Find out the path to TortoisePlink.exe. It should be located in your TortoiseHg install directory
3. Locate the path to your private key file (.ppk)
4. To tell TortoiseHg and MercurialEclipse to connect with ssh and the public/private keypair you need to add a config value in
the mercurial.ini. Edit it via TortoiseHg -> File -> Settings -> Edit File and add the following lines
username = dwasser
ssh=”C:\Programme\TortoiseHg\TortoisePlink.exe” -ssh -agent -i “C:\Dev\Putty\dwasser.ppk”

Here is a screenshot of the EditFile dialog (be careful, use the String above it contains the -agent property which means that Pageant should be used)

Sometimes there is some trouble with the Windowspath to TortoisePlink.exe. If so, extend your Path Variable to the
Tortoise directory and set the ssh value in the mercurial.ini to:
ssh=TortoisePlink.exe -ssh -agent -i “C:\Dev\Putty\dwasser.ppk”

This is important, because this configuration will be used by TortoiseHg


MercurialEclipse. It tells the Applications to use TortoisePlink as “ssh bridge”.
If you want to use cygwin with openSSH, install it, add the folder cygwin/bin to the PATH variable
of Windows and use the following configuration instead : ssh = C:\yourpathto\cygwin\bin\ssh

5. Now all Actions should work. For example you should be able to clone a repository by clicking
File -> clone and enter an Url in this way ssh://dwasser@ . Don’t forget to mask the slashes!!

### To get MercurialEclipse working: ###
6. Nothing special here, just create a new Project of type mercurial and enter the URL. Also use an Url of this type: ssh://dwasser@

Leave a Reply

Your email address will not be published. Required fields are marked *