version control - How do I prevent a "No supported authentication methods available" error when using TortoiseHg?

25
2013-11
  • jammus

    I'm trying out Mercurial for the first time but am having problems doing a push/pull/clone with a remote server (in this case it's codebasehq.com) when using TortoiseHg.

    Here are some steps to reproduce:

    1. Download and install TortoiseHg
    2. Go to directory where I want my repository
    3. Right click -> TortoiseHg -> Clone
    4. Enter ssh://[email protected]/accountname/projectname/repositoryshortcode.hg as the source path
    5. Click Clone

    Once I've clicked Clone it pops up a error dialogue

    "PuTTY Fatal Error" "Disconnected: No supported authentication methods available."

    and when returning to the clone dialogue this error is shown:

    running ""C:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 [email protected] "hg -R accountname/projectname/repositoryshortcode.hg serve --stdio"" no suitable response from remote hg

    [command interrupted]

    What do I need to do to prevent this error and successfully interact with the remote repository?

  • Answers
  • jammus

    Clocked it. I needed to create an ssh-key pair. To do this I opened puttygen.exe and generated a key. Then I run pageant.exe and added the generated key to its list. The final stage was to log in to codebasehq and add the text of the key (from the box in puttygen labelled 'Public key for pasting...') to my profile.

    Hope this helps someone.

    (I'm going to accept my own answer but if someone can come up with a more concise answer I'll happily accept yours instead)

  • Fabian

    I just had the same error message. But in my case, the problem was an outdated Pageant version that came with TortoiseHg.

    A great trick to debug the "No supported authentication methods available" error message is to add -v in mercurial.ini

    \# Generated by TortoiseHg settings dialog
    [ui]
    username = name <[email protected]>
    ssh = "TortoisePlink.exe" -ssh -2 -batch -C -v
    

    Output:

    remote: Pageant is running. Requesting keys.
    remote: Failed to get reply from Pageant
    remote: Using username "hg".
    remote: Disconnected: No supported authentication methods available (server sent: publickey)
    no suitable response from remote hg
    

    Also see:

    http://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Mercurial

    http://confluence.atlassian.com/display/BITBUCKET/Troubleshooting+SSH+Issues


  • Related Question

    Creating an ssh-key just for mercurial pulls/clones
  • goathens

    I want to make an ssh key (passwordless) that I can hand out to remote users so they can do an hg pull or hg clone of my repositories. I've gotten as far as making an ssh key that uses only the command /usr/bin/hg but that doesn't work when using the clone or pull commands, because the command string doesn't match whatever the remote command call mercurial uses internally.

    Is it possible to get the commands mercurial executes on the remote host when you do a:

    hg clone ssh://user@host//path-to-repo
    hg pull ssh://user@host//path-to-repo
    

    And can I reliably come up with a couple command strings that will cover all my bases? If they were going to pull with a specific revision, would that use a different remote command through the ssh?


  • Related Answers
  • Ry4an

    Mercurial comes with handy script already setup for exactly this sort of restricted access. THe script is probably already on your server and is named hg-ssh, but you can also find it here: http://www.selenic.com/repo/hg-stable/raw-file/tip/contrib/hg-ssh

    To use it just put a line like this in your /home/user/.ssh/authorized_keys file:

    command="hg-ssh path/to/repo1 /path/to/repo2 ~/repo3 ~user/repo4" ssh-dss ...
    

    that'll make sure that people w/ that key can only use mercurial (not a shell) and only on the repos you list.

  • Takayuki SHIMIZUKAWA

    So if you don't want to let them push, then I recommend that use --read-only option for hg-ssh command in addition to Ry4an's answer.

  • Alasdair

    Sign up to bitbucket and clone your repository to it - you get one private repository and 150MB free.

    Then get your users to sign up for bitbucket, and give them read-only permission. They can then access the repository using https, or ssh if they upload their public key.

    Alternatively, you could set up a second, shadow bitbucket account, give it read-only permission, then upload a public key and share the private key with your users. They can then clone over ssh using the shadow account's public key, without signing up individually.