The vast majority of AppVeyor customers use Git, specifically GitHub. Historically, we’ve been using Mercurial for AppVeyor source control, but recently due to the growing popularity and ecosystem of Git and GitHub we thought maybe it’s time to jump Git train and start using it for AppVeyor projects.

The first problem we faced with was converting existing Mercurial repositories to Git with preserving all history and authors. If you search in Google for converting mercurial to git on Windows you will find some (mostly similar) posts on SO, but none of them worked for us if followed “as is” on Windows. After many trials we found the way that 100% works and could be easily reproduced - everything was done from scratch on a clean Windows Server 2012 machine.

This article specifically describes migration of project from BitBucket’s Mercurial repository (original) to GitHub (migrated) using hg-fast-export tool.

Install required software

We assume you start from a clean Windows Server 2012 machine.

Open command line prompt and make sure all tools are available in the PATH: hg, git, python.


We will be doing everything in c:\projects directory.

Open command prompt.

cd c:\projects

Clone source Mercurial repository:

hg clone

Create an empty GitHub repository and clone it to demoapp_git directory:

git clone demoapp_git

Clone hg-fast-export repository:

git clone

Open c:\projects\fast-export\ in Notepad and replace highlighted region with the code below:


#!/usr/bin/env python

# Copyright (c) 2007, 2008 Rocco Rutte <> and others.
# License: MIT <>

import sys

# import mercurial libraries from zip:
sys.path.append(r'C:\Program Files (x86)\Mercurial\')

from mercurial import node
from hg2git import setup_repo, fixup_user, get_branch, get_changeset
from hg2git import load_cache, save_cache, get_git_sha1, set_default_branch, set_origin_name
from optparse import OptionParser
import re
import os

Copy content of fast-export to demoapp_git ignoring .git folder.

Switch to demoapp_git directory:

cd demoapp_git

If you need to map authors to new repository with different name/email create authors.txt with one mapping per line (old=new), like below:

Feodor Fitsner <>=Feodor Fitsner <>

Run Python script to import Mercurial repo into Git one (you are running this script from Git repository directory): -r c:\projects\demoapp -A authors.txt

Checkout HEAD to check that everything looks good:

git checkout HEAD

Remove conversion files:

git clean -f
del /Q hg2git.pyc

Rename .hgignore to .gitignore:

ren .hgignore .gitignore
git add .gitignore
git commit -m ".hgignore renamed to .gitignore"

Push Git repo to GitHub:

git push -u origin master