
Run puttygen.exe and choose Import key from the Conversions menu. PuTTY uses its own private format for SSH private keys, so you'll need to convert your private key.
Copy your SSH private key onto your Windows machine. You may want pscp.exe as well if you plan to do SCP, but it's not necessary for running Mercurial. To get your passphrase-locked SSH keys to work properly under PuTTY, you'll need to go through the following steps.ĭownload putty.exe, puttygen.exe, pageant.exe, and plink.exe from the PuTTY website. Interesting that path to key could be quoted. I ended up creating C:\Bin and copying plink.exe there. That took a while to figure out :-( - krupanĪlso observed the effect above: no attempts to quote plink path worked - very ugly errors, like remote: Incorrect file name, directory name, or volume label. abort: no suitable response from remote hg! and unquoted path like C:\Program Files\Putty\plink.exe resulted in attempts to run C:\Program. It didn't work when I put quotes around /path/to/plink.
I got this to work with my passphrase-locked ssh keys by following the directions below, but the Mercurial.ini syntax above seemed to be very sensitive. I also found the -i parameter to be unnecessary when using pageant if I have loaded my key in pageant, plink finds it. The -ssh parameter is unnecessary anyway, because SSH is the default protocol. But 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. I found that plink.exe will first use the hostname to look up a saved PuTTY session of that same name, and get the correct port number from there. I'm using a non-standard SSH port number. When an ssh operation fails, you can use the -debug argument to figure out what went wrong. Any activity that would normally require user interaction (a new host key, for instance) will cause plink to exit immediately rather than stall. Plink.exe also has a -batch argument which tells plink to run non-interactively.
Connect to remote ssh host over ssh using PuTTY once and have PuTTY save its key as a known host.Īdd the following to the section of your ~/Mercurial.ini file ssh="C:\path to\plink.exe" -ssh -i "C:\your path to\private.key". Grab putty.exe and plink.exe from PuTTY website. For a workaround, load your keys into Pageant utility ( pageant.exe from PuTTY) or get TortoisePlink.exe from TortoiseHg distribution. It expects the password to be entered at stdin, but stdin is redirected. Original plink.exe will lock if private keys are password protected.