Cloning a Mercurial repository over SSH

MercurialSshWebfaction

Mercurial Problem Overview


I'm having some difficulty cloning my mercurial repository over ssh.

Here's what I have tried:

hg clone ssh://[email protected]/path/to/projectname projectname

It's giving me this error:

remote: bash: hg: command not found
abort: no suitable response from remote hg!

hg is installed on the server, however.

I was trying to follow the instructions on this website.

Mercurial Solutions


Solution 1 - Mercurial

You need a double // after hostname i.e.:

hg clone ssh://[email protected]//path/to/projectname projectname

Solution 2 - Mercurial

Sounds like hg is not on your path. The Mercurial FAQ mentions possible fixes for this issue: FAQ/CommonProblems.

Add the remotecmd value to your Mercurial configuration by opening ~/.hgrc (or Mercurial.ini on Windows) on your client machine and adding the following:

[ui]
remotecmd = /path/to/hg

where /path/to/hg is the path to the hg command on the remote server.

If you're having problems with your Mercurial configuration, you can use the hg showconfig --debug command to obtain a full list of your Mercurial settings along with the path and line number of the configuration file that defines each configuration value.

Solution 3 - Mercurial

Looks like mercurial isn't in your user's PATH on the remote server.

Solution 4 - Mercurial

On webfactional I had to add:

export PATH=$PATH:/home/<user>/bin

to .bashrc to get it to work. (also followed the remotecmd advice above)

Solution 5 - Mercurial

You can use Sourcetree, TortoiseHg, Mercurial from the terminal, or any client you like to clone your Mercurial repository. These instructions show you how to clone your repository using Mercurial from the terminal.

  1. From the repository, click + in the global sidebar and select Clone this repository under Get to work.
  2. Copy the clone command (either the SSH format or the HTTPS). If you are using the SSH protocol, ensure your public key is in Bitbucket and loaded on the local system to which you are cloning.
  3. From a terminal window, change to the local directory where you want to clone your repository.
  4. Paste the command you copied from Bitbucket, for example:
    CLONE OVER HTTPS:
    $ hg clone https://[email protected]/teamsinspace/hg-documentation-tests
    CLONE OVER SSH:
    $ hg clone ssh://[email protected]/teamsinspace/hg-documentation-tests
    If the clone was successful, a new sub-directory appears on your local drive.
    This directory has the same name as the Bitbucket repository that you cloned.
    The clone contains the files and metadata that Mercurial requires to maintain the changes you make to the source files.

Solution 6 - Mercurial

On the server, type: nano ~/.bashrc end edit the file by adding:

# User specific aliases and functions
export PATH=$PATH:$HOME/packages/mercurial

Under the assumption that ~/packages is the folder where mercurial was installed. After editing, finish off with source ~/.bashrc and try again.

Pretty helpful to me was the following elaborate guide to install mercurial on a Bluehost hosting server.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJoshView Question on Stackoverflow
Solution 1 - MercurialanteatersaView Answer on Stackoverflow
Solution 2 - MercurialRichard CookView Answer on Stackoverflow
Solution 3 - MercurialOneOfOneView Answer on Stackoverflow
Solution 4 - MercurialkdahlhausView Answer on Stackoverflow
Solution 5 - MercurialMurari KumarView Answer on Stackoverflow
Solution 6 - MercurialSerge StroobandtView Answer on Stackoverflow