Using AppHarbor with Mercurial and hg-git
NOTE, THIS GUIDE IS OBSOLETE: You can now push your code to Bitbucket and allow us to fetch it from there. Read instructions here
Make sure Mercurial is installed
- Install TortoiseHg (or your Mercurial-client of choice)
- Initialize a repository (right-click on the project folder and use the TortoiseHg option for that
- Add your username to your global settings
- Make your initial commit
- Download Git, go for Git-188.8.131.52-preview20101002.exe (or newer)
- Install Git and make sure to select "Run Git from Windows Command Prompt" option when prompted.
Download and set to up hg-git
Go to http://hg-git.github.com/ for full reference
- Clone the hg-git repo to a convenient place (e.g.
c:\src\hg-git). Here's the relevant command:
hg clone https://bitbucket.org/durin42/hg-git
- Add this configuration to your global or repo hg configuration file (called "mercurial" ("hgrc" on Mac/Linux) in the root of your user folder. Can also be accessed with TortoiseHg, by right clicking -> TortoiseGit -> Global Settings -> Edit File):
Remember to change the hggit line to where you actually cloned the hg-git repo.
[extensions] hgext.bookmarks = hggit = c:\src\hg-git\hggit [git] intree=1
Set up your Mercurial repository to export to Git
- Using your command line, navigate to your Mercurial repository
- Add a default branch to be tracked by Git:
hg bookmark master -r default
- Ignore Git-related files in the mercurial repo by opening the hgignore file and adding: ".git"
Set up AppHarbor as a Git remote
- To create a Git repo, in your command line, write:
git remote add appharbor https://firstname.lastname@example.org/myapplication.git
And you're set up!
Finally, you can push your code by first exporting your Mercurial repo to Git, and then pushing the Git repo. This will be the way you should always prepare and push a mercurial repo through Git to AppHarbor:
- hg gexport
git push appharbor master