mercurialtortoisehgssh-keysplinkpageant

How to use TortoiseHg from command line without PuTTY (Pageant)


Earlier I used Mercurial command line installation and it worked fine for me with default ssh client and keys location in ~/.ssh.

On my new laptop I installed TortoiseHg. Now any remote request (like hg pull, or hg incoming) generates PuTTY Fatal Error:

Disconnected: No supported authentication methods available (server sent: publickey)

enter image description here

Quite similar result if i try to acces repository over ssh directly: ssh -vT git@bitbucket.org

The problem may be solved using Pageant (plink): run it and add putty key, or add pageant (plink) to Mercurial config file.

BUT, i'm looking how it is possible to work in old way, without pageant or plink, using only default ssh keys location?


Solution

  • Looks like opposite to git Mercurial does not provide own ssh client, so using Plink and Pageant is mandatory, except two workarounds:

    1. Use TortoisePlink as ssh client with explicit key reference in Mercurial config (%USERPROFILE%\.hgrc or %USERPROFILE%\Mercurial.ini):

      [ui]

      ssh = "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -ssh -i %USERPROFILE%.ssh\id_rsa.ppk

    2. If you have installed git or cygwin (or any other way to use ssh on Windows), it is possible to use third party ssh client pointing path in Mercurial config:

      [ui]

      ssh = "C:\Program Files (x86)\Git\bin\ssh.exe"

      # or

      # ssh = "PATH_TO_ANY_OTHER_SSH_CLIENT_LIKE_CYGWIN"

    I tried both ways -- they work excellent.

    I use second one, because I use git distributed tools on my PC as main ssh agent. First option is suitable if you don't have ssh alternative on your PC.

    Notes: