all,
I have searched for this problem for long time and tried different methods.
I want to maintain my code on the server through only SSH. But when I run this:
sudo hg clone -v ssh://carl@hostname//home/carl/Java/Projects/peta/
Mercurial keeps telling me remote: abort: There is no Mercurial repository here (.hg not found)!
. Some articles said that the path should be correct and there should be a .hg
directory there. But I have checked it for several times and I am sure there is a .hg
folder at the right place.
I also tried
hg --config ui.remotecmd=/usr/bin/hg clone ssh://carl@hostname//home/carl/Java/Projects/peta/
But it failed as well. What other problem it could be? Thanks.
Solved
I finally fix the problem. Previously, I create a repository on my local machine, and scp all files (including .hg
) on to the server. I try to remove .hg
directory first, and create a repo on the server through ssh (hg init
). Then hg clone
works!
Extraction from hg help urls
Some notes about using SSH with Mercurial:
this means, at least, that you can't use the same URI and change only one/two slash it it: at least one path will be non-existent.
Consequence of the quote and error message: you must to debug (with any ssh-tool) and find correct path to needed directory. you can:
- use scp (f.e) and copy known file from known location
- SSH into remote host in interactive session and verify path (both?) by hand, i.e: ssh ..., cd ..., pwd, verify output of pwd
- ... any other debugger
When you'll get good path after login, you have to check next point of failure - .hg dir permissions
After verification of these checkpoints you'll get clone and some bonus in the form of understanding "What happened before"
HTH
I don't know if this really helps but, according to the FAQ:
hg clone ssh://USER@REMOTE/path/to/repo
They are using only one /
after the USER@HOST
. Maybe you can try that way.
César Bustíos's answer is almost correct, but that tries to clone from remote to local. To opposite way, we have to add the local path. In the case it is the current directory, it will be a dot.
hg clone . ssh://USER@REMOTE/path/to/repo
Hope it helps. :)
Running on Debian, to solve my problem, I have added the following line to my /var/lib/mercurial-server/.mercurial-server
configuration file after the [paths]
[paths]
/ = ~/repos
...
And don't forget to issue this command afterwards: sudo -u hg /usr/share/mercurial-server/refresh-auth