Mercurial and Git in one repository

I have a personal project hosted at bitbucket using Mercurial as the version control system. Since I started that project, I’ve been using GitHub for everything. I just found hg-git instructions on It is pretty awesome.

For my purposes, it allows me to maintain the project on two remote servers, one running Mercurial, the other running Git.

To see how it works, first install hg-git:

$ sudo easy_install hg-git

Then, edit your ~/.hgrc settings, adding to the [extensions] section:

hgext.bookmarks =
hggit =

Also, be sure your ~/.hgrc contains a valid email address:

username = Jim Schubert <>

Now, you can create a repository on and push your Mercurial commits:

$ cd ~/projects/project_name
$ hg bookmark -r default master
$ hg push git+ssh://
$ hg push

If you’re only planning on using Mercurial to push changes to github or some other Git host, you can add that path to ~/.hgrc:

default-push = git+ssh://

Flattr this!