I’m having difficulty figuring out how to clone my Mercurial repository from my local machine to the server. I actually found an answer to my question here (As the second part of #4.5 in https://www.mercurial-scm.org/wiki/FAQ), but I don’t know what to do with the answer.
On the other hand, if the error
message is remote: bash: line 1: hg:
command not found, the problem is that
the environment used by ssh does not
have hg in its PATH. There are two
ways to deal with this problem:In your ~/.hgrc file, set a remotecmd
value in the [ui] section giving the
exact path to hg. On the server,
create a ~/.ssh/environment file that
defines an appropriate PATH, and add
PermitUserEnvironment yes to
/etc/sshd_config.
I would like a clearer explanation of how to solve this problem BOTH ways. How does one find out the exact path of their Mercurial installation? What is an “appropriate PATH” to use on the server?
Log on to the server and run
command -v hg. The response is the full path to hg that would be run given your current environment. Now that you know the full path, you can easily use the remotecmd option in your ~/.hgrc.The most basic PATH that a user should have is
/usr/bin:/bin(although/usr/local/bin:/usr/bin:/binis also common). The appropriate PATH for your situation is whatever your current $PATH is plus the directory that contains the hg binary, as determined above —/usr/bin:/bin:/path/to/hg/dir.