Everyone seems to use GitHub nowadays, but occasionally you want a private repo (without paying), so you set up a local Git repo instead. The problem being, you often lose the integration with the other tools that you use to manage projects. Git has the ability, but it is somewhat reliant on you having the relevant scripts available (such as post-receive).
This documentation details how to configure your Git repo to link up with Pivotal Tracker.
Pivotal Tracker is a project management system designed around Agile methodologies, it's not free but it's not particularly expensive in the scheme of things. It's certainly a helpful tool for large projects, and GitHub has the relevant integration available, allowing you to display commits as a comment on a story.
Unfortunately, for whatever reason, they don't seem to support ordinary webhooks, having opted for an XML API instead, so we need a custom post-receive script.
First we need to fulfil a dependency of my post-receive script, a modified version of dict2xml, so run the following
wget "https://github.com/bentasker/dict2xml2/raw/master/dist/dict2xml2-0.1.tar.gz" tar xvzf dict2xml2-0.1.tar.gz python setup.py install
My modified version of dict2xml is now installed. Now, we're going to setup a new repo (skip this step if you already have one)
mkdir mynewrepo git init
Now we want to add the post-receive script to the repo's hooks
cd .git/hooks/ wget -O post-receive "https://raw.github.com/bentasker/notify-webhook-pivotal-tracker/master/notify-webhook-pivotal-tracker.py" chmod 755 post-receive cd ../..
Finally, we need to set some configuration options.
git config hooks.webhookurl "http://www.pivotaltracker.com/services/v3/source_commits" git config meta.apikey "YOURKEY"
If your commits are publicly available you can add the URL (the commit ID is substitued for %s to whatever you specify) with
git.config meta.commiturl "yoururl/%s"
The next time you make a commit, it's details will be pushed to Pivotal Tracker. If the commit message contains a story id (in the format [#id] i.e. [#123456]) a comment will be added to that story, if you're adding to a remote repo, commits will be sent whenever you push.
You can also change the status of a story with your commit message, see the Pivotal Tracker API documentation for more information.
Getting your Pivotal Tracker API Key
They make it really easy to get your key;
- Log into Pivotal Tracker
- Click your name in the top right corner
- Choose Profile
- Scroll right down to the bottom of the page
- Your API key(s) are there, you may need to click the add button if there isn't one.