Starting a mercurial (hg) remote repository

2009 March 7

I always forget and have to search for the correct order of things here…

There are some VCS — as in Version Control System — (and DVCS, where the “D” stands for Distributed) where you can create a copy of the repository on your own system and then somewhat easily move it to the server or copy it there using the VCS software itself.

Mercurial seems to require that the thing be done in two stages:

  1. Create the repository on the central (reference) server
  2. Clone the repository on each workstation

So, here are the commands that should be run to accomplish that:

At the reference server

hg init <repository_name>

At the workstation

hg clone ssh://user@server//path/to/repository/<repository_name> <local_name>

Yes, it is that simple…  But since I work for a long time on projects, I always forget to double the slash after the server name while cloning and that I need to create the repository on the server “first”, to later start working with it locally.

I could probably do the opposite and revert the clone order, but then I am not sure if “push” and “pull” would be switched or if something else would be required to make them work.

No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS