tags:

views:

151

answers:

2

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?

+3  A: 

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.

Ry4an
cool, thanks, but how do other people clone it though?
Alex N.
they can just clone from ssh://you@server//home/you/repo if they're allowed to read from your homedir. If you're not okay with that you can set up an area to which you can both read and write.
Ry4an
A: 

If your "official" repositories are served up by an HTTP server, and you want to create a repo in the central location based on a local machine's repo, here's one way. You need admin rights on the central server to do this.

e.g. I'm developing on windows, and my central repository is running on linux and served by lighttpd per the official guide. The server's central repo directory is /var/hg/repos/, owned by the user/group www-data. My local machine's IP is 10.1.10.100, and the repository I want to clone is named foo.

  1. On the local machine, open a command prompt into the repository directory and type hg serve. This runs the local hg web server, which will allow the server to pull from it.
  2. ssh into the central repo server, logging in as a user with sudo rights to www-data.
  3. cd /var/hg/repos
  4. sudo -u www-data hg clone http://10.1.10.100 foo
Dan Tanner