Pushing to multiple hg repositories

Pushing to multiple Mercurial repositories is just a matter of adding a line (or two, or three, etc.) to a local repository’s .hg/hgrc.

Just recently created a private repo up on Bitbucket to facilitate collaboration with one of our global development teams.

Configuring your local copy of a repo to allow pushing to multiple remote repositories is pretty simple: all you have to do is add a definition in .hg/hgrc under [paths], this:

default = http://sourcecontrol.example.com/hgweb/newproject
bitbucket = https://mybituser@bitbucket.org/bigcorpdev/newproject

Push to the “default” remote repo with a simple:

hg push

To select Bitbucket instead you’d do this:

hg push bitbucket

That’s all there is to it!

This entry was posted in Development on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).