redmine – automatic synchronization of your git repo

27 Apr
2009

Redmine is a really great project tracking tool. Its been there 3 years now, and lately smashed track from the throne as my former #1 tool. Its got all the features i wanted from trac (subprojects, git support, …), plus it’s much nicer to use (ajaax!), its written in rails (hell i like rails), and development is going really fast (thanks to Jean-Philippe Lang). I just use the trunk, never had any problems with it. (0.9 pre)

I am using apache, phusion passenger, mysql (i may switch to postgres, oracle, u know why…), git and gitosis on a ubuntu hardy machine.

Redmine has fine git integration. BUT – it can’t [yet] read from bare git repos, which you get with using gitosis as your git management tool. This is where the fun begins:

I assume that you already set up gitosis. (change the path to map your configuration)

So change your /home/git/repositories/<yourepo>/hooks/post-update file

echo "Update server local copy..."

export GIT_DIR=$WORKDIR/.git

pushd $WORKDIR &gt; /dev/null
git reset --hard
git pull
popd &gt; /dev/null

WORKDIR="/home/git/checkout/&lt;yourrepo&gt;"

/usr/bin/git-update-server-info

unset GIT_DIR

Well, it’s not perfect, maybe some people are more comfortable if the whole output is moved to /dev/null, but it works pretty well.

Don’t forget to create a _local git copy_ (via git clone git@localhost:<yourrepo>.git in /home/git/checkout (or whatever folder you prefer)

Comments on this are appreciated. It took me a while to figure that out…

If you are on github, you may like this instead.

Related posts:

  1. HOME
  2. Database transfer with taps
  3. Git! Git!
  4. Demystifiying Rails Model attributes overriding
  5. git magic: undo/redo commits

2 Responses to redmine – automatic synchronization of your git repo

Avatar

azer

May 4th, 2009 at 10:20 am

Hi,

I’m using gitosis, and I’d like to publish all repositories changes to my redmine tool. Gitosis and Redmine are running on the same server.

gitosis path : /gitosis – /gitosis/repositories/
redmine : /home/redmine

I can’t understand how I could synchronize the git repositories with redmine.

Can you help me please ?

thanks in advance for your helps (sorry for my bad english, I’m a french people).

azer.

Avatar

adhisimon

March 24th, 2010 at 4:12 pm

Nice tips, but I think you missordered this lines

WORKDIR=”……”

must be set before

export GIT_DIR=$WORKDIR/.git

Comment Form

top

Switch to our mobile site