Mercurial clone through ssh

I want to do some backup of my work on the remote machine. My first try was with hg push but it turn out that hg push require a repository to be exist on the remote end. So I just tarred up the local repo and manually copying the tarball using scp and then did an hg pull to get it back. This way I can just push my changes as a backup in the future. But something is wrong somewhere.

$ hg clone ssh://me@remotehost/home/kamal/hg/repo/
remote: abort: There is no Mercurial repository here (.hg not found)!
abort: no suitable response from remote hg!

It’s weird since doing hg log on the remote repo work just fine. So I try to execute the command with a verbose option, thank god they have it.

$ hg -v clone ssh://me@remotehost/home/kamal/hg/repo/
running ssh me@remotehost "hg -R home/kamal/hg/repo/ serve --stdio"
remote: abort: There is no Mercurial repository here (.hg not found)!
abort: no suitable response from remote hg!

That’s it. A path problem. Add another slash to the path would make it work. Then I checked back the man page and it clearly stated:-

- path is relative to the remote user’s home directory by default. Use an extra slash at the start of a path to specify an absolute path: ssh://example.com//tmp/repository

I use an absolute path because the first try using the common ‘~/’ for my home directory does not work. Next time, carefully read the manual !

Comments

Exactly what I needed. Danke

Exactly what I needed.

Danke ;)

Pushing clone over ssh

Hi,

Instead of tarring the local repo, you could also just have cloned it in the "push" direction with:

hg clone ./local-repo ssh://me@remotehost//home/kamal/hg/repo

or even

hg clone ./local-repo ssh://me@remotehost/hg/repo

hg clone

Thanks Ferdirand.

However mercurial did not print any progress when I did a clone to the remote server, made me thinking that it was stalled.

very concise and it works, thank you

I needed to clone a project today and decided to do a search on the net before attempting it myself. Thanks for saving me some time and a headache.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options