Tag Archives: GitHub

Syncronizing Redmine & BitBucket repositories

So, you have a Redmine installed somewhere, and also using BitBucket for hosting your repositories and tring to find a way to synchronize your BitBucket repository with your Redmine one? This is how can be done (same applies for GitHub, actually we’re using the very same redmine plugin which was originally written for GitHub. Regardless of being actually made for GitHub, works great for BitBucket too 🙂 )

First, you need to install the json gem for ruby, as the plugin requires it:

gem install json

then you need to setup the redmine plugin. For this you have to go to your redmine install folder, and then from here head to vendor/plugins folder. Once there, clone the redmine github hook plugin:

git clone https://github.com/koppen/redmine_github_hook.git

then do the usual plugin installation thingies to install the plugin into redmine:

rake db:migrate:plugin NAME=redmine_github_hook RAILS_ENV=production

and then restart your Redmine. Now you’re set on Redmine site.

Your git repository need to be have as remote origin your BitBucket repository, so you’ll want to run something like:

git –git-dir=’your_repositories/your_repository.git’ remote add origin git@bitbucket.org:your_user/your_repository.git

This completes your server side setup. In your BitBucket account, you’ll need to setup a POST service which will notify your Redmine to update it’s repository. For this you’ll have to go to your repository admin page, then select services on the right menu. Then in the drop-down select POST and for the URL enter your an URL like this:

http://your redmine web address/github_hook?project_id=your redmine project name

That’s it. Now each time you do a commit in your BitBucket repository, your Redmine repository will get updated accordingly (and everything else depending on this, like activity,etc).

P.S. These steps can be applied also to your GitHub account, should work without any problem.

Happy commiting 🙂