Search code examples
mercurial

How to clone repository to a remote server/repository with Mercurial


Found myself quite confused today about this.

I create a blank repository locally(hg init), cloned it to working copy, added some code, commited and pushed it(to local repo obviously).

Now I need to share that repository with others. There is a server that has mercurial on it, how do I clone my repository to a remote one such that other developers can access it and pull/push code from/to it?


Solution

  • You'll want to check out the publishing repositories wiki page to get into web interfaces and access controls, but at it's most basic you can do something like this:

    hg clone yourlocalrepo ssh://you@server//home/you/repo
    

    That clones your local repo to a remote location of your choosing. Note that there are two double slashes in that URL.

    You can't create a remote repo like that using http://, only ssh://. If all you have is http to hgweb.cgi you can 'hg init' an empty repo on the server and then hg push to it.