If you’re using GitHub as your shared, online, git repository and you’re using AppHarbor for continuous integration and deployment, you really have two git repositories – the GitHub one and the AppHarbor one.

AppHarbor instructions help you set up a remote to this git repository so you can push to it whenever you like, but that means you have two steps on most commits:

git push origin master

to push your code up to your GitHub repo, and:

git push appharbor master

to push your code up to the AppHarbor repo.  Because AppHarbor doesn’t support SSH yet (only HTTPS is supported now), you also have to enter your password.  Not a giant hassle, but what if you could get rid of that last little bit of friction?

GitHub Service Hooks

GitHub Service Hooks run after a push to GitHub, and there is one to fire off your AppHarbor build/test/deploy.  It’s under your GitHub repo > Admin > Service Hooks.

Once you’re there, the instructions are pretty simple.

  1. Go to your application's main page on AppHarbor and find the "Create build URL". Example: https://appharbor.com/application/{application_slug}/build?authorization={token}
  2. "token" is the value of the "authorization" parameter.
  3. "application_slug" is your application's unique identifier.
  4. If your GitHub repository is private you need to add the "apphb" GitHub user as a collaborator. This enables AppHarbor to download the source code.

Here’s where you can find the values for steps 1-3 in AppHarbor:

Step #4 can be skipped if you have a public repo.  If you’re using private repos, add the “apphb” GitHub user to a GitHub team with “pull” grants.

All done!

Next time you do

git push origin master

your code will be pushed up to GitHub and AppHarbor will grab the latest code from GitHub (not from the AppHarbor repo anymore), build it, test it, and if the tests pass, deploy it.  All in one step!