Setting up a remote Mercurial repository

Note: This post is mostly a note to myself. I don't do this often and I always forget a step when I need to do it again.

I have Mercurial set up on my hosting provider. I'm using hgweb.cgi and it works well enough. However, Mercurial does not seem to support pushing new repositories remotely when using this configuration. That is, you can't just run an hg push on the client or anything like that - you need to do some manual setup.

The steps to do this are as follows:

1) On the client, do you hg init to create a new repository.
2) Copy this directory to your server in the appropriate location.
3) On the server, edit your new_repo_dir/.hg/hgrc to something like this (if you have one that you copied form step 1, just nuke it):

[web]
allow_push = youruser
description = Some description
name = your_repo_dir

4) Add a line like this to your hgweb.config:
your_repo_dir = /path/to/repo/your_repo_dir

Assuming that the rest of the server is already set up, that should do it. I always keep forgetting one of the last two steps, for some reason (probably because I only do this once in a while).

You can reply to this entry by leaving a comment below. You can send TrackBack pings to this URL. This entry accepts Pingbacks from other blogs. You can follow comments on this entry by subscribing to the RSS feed.

Add your comments #

A comment body is required. No HTML code allowed. URLs starting with http:// or ftp:// will be automatically converted to hyperlinks.