Redmine plugin: Github Hook
If you too fit this description, I have a little treat for you; a Redmine plugin that makes Github integration easy.
Redmine and Github in the old days
Redmine has built-in support for Git repositories, allowing you to browse your code and view your changesets directly in Redmine. For this purpose, it relies on local clones of the Git repositories.
If your shared repository is on a remote machine – for example on Github – this unfortunately means a bit of legwork to keep the local, Redmine-accessible repository up-to-date. The common approach is to set up a cronjob that pulls in any changes with regular intervals and updates Redmine with them.
Redmine and Github in the future
The cronjob approach works perfectly fine, but is a bit heavy-handed and cumbersome for my taste. So I created the Github Hook plugin for Redmine, which allows your Redmine installation to be notified when changes have been pushed to a Github repository.
- Installing the plugin
- Install the json gem <http://json.rubyforge.org/> on the machine where Redmine is running.
- Install the plugin from http://github.com/koppen/redmine_github_hook by following the standard plugin installation procedure.
- Restart your Redmine.
- If you already have a local Git repository set up and working from Redmine go to step 3, otherwise continue at step 2.
- Adding a Git repository to a project (note, this should work whether you want to use Redmine Github Hook or not)
- Go to the directory on your Redmine machine where you want to keep your repository, for example /home/redmine/repositories/.
- Get a clone of the repository into that location: git clone git://github.com/koppen/redmine_github_hook.git. This creates a .git directory at /home/redmine/repositories/redmine_github_hook/.git
- Open Redmine in your browser and navigate to the Settings for the project you want to add a Git repository to.
- Under the Repository tab, choose Git as your SCM and enter the full path to the .git directory from step 2; /home/redmine/repositories/redmine_github_hook/.git . Click “Create”.
- Click the new “Repository” link in the main navigation to verify that your repository integration works.
- Connecting Github to Redmine
- Go to the repository Admin interface on Github.
- Under “Service Hooks” add a new “Post-Receive URL” of the format: “[redmine_installation_url]/github_hook” (for example “http://example.com/github_hook”).
That’s it. Using the magic of Post-Receive Hooks" Github will now send a HTTP POST to the Redmine Github Hook plugin whenever changes are pushed to Github. The plugin then takes care of pulling the changes to the local repository and updating the Redmine database with them.
You can grab the plugin at http://github.com/koppen/redmine_github_hook/