Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

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

  1. Install TortoiseHg (or your Mercurial-client of choice)
  2. Initialize a repository (right-click on the project folder and use the TortoiseHg option for that
  3. Add your username to your global settings
  4. Make your initial commit

Install Git

  1. Download Git, go for Git-1.7.3.1-preview20101002.exe (or newer)
  2. 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

  1. 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
  2. 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

  1. Using your command line, navigate to your Mercurial repository
  2. Add a default branch to be tracked by Git: hg bookmark master -r default
  3. Ignore Git-related files in the mercurial repo by opening the hgignore file and adding: ".git"

Set up AppHarbor as a Git remote

  1. To create a Git repo, in your command line, write: hg gexport
  2. git remote add appharbor https://[email protected]/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:

  1. hg gexport
  2. git push appharbor master