Making Redmine play nice with Git
Delving into the world of version control while keeping tabs in an issue manager is wonderful - if you manage to actually set it up. I've enjoyed it for some time, and tried to replicate it in my own installation of Redmine - and thus started the hair pulling.
First off, I assume you have managed to get Redmine ( or Chiliproject ) up and running via Apache, Ruby Enterprise Edition and Passenger module. That means that you can create tickets etc, and now want to add source control management (SCM) to that mix. My personal favorite SCM is Git.
I wanted my projects to automatically get their own Git repo, with minimum amount of fuss involved. That's where Gitolite came in, and saved the day. It manages git repos and users via it's own git repo. Actually setting up gitolite is beyond this posts' scope -- I assume you already have it setup and can get a repo list via ssh. There's some good documentation available for that.
I found out that a plugin for Redmine to do all the heavy lifting exists -- enter (quite predictably) redmine_git_hosting . And while it comes with step by step instruction, there's a lot being left out, hence this article.
For starters, a sanity check:
- Is your Passenger running as a fixed user? By default (which I'm sure is useful when hosting ruby, but more of a pain if you want to just run redmine), Passenger will spawn a process for each application (website) using the user who owns the file config.ru in the root of the app. And that behavior overrides the PassengerDefaultUser directive, if you were using that in your config. You need to either change the owner (which I didn't want to do), or tweak the Passenger config file:
PassengerUser passenger PassengerGroup passengerwhere passenger is the username of the user you wish to user.NOTE:The user you define for Passenger must be a "normal" user, in the sense that he must have a home directory -- otherwise the plugin messes things upIf you just changed the user, you need to set folder permissions again -- as a reminder, assuming you are in the redmine installation root, use
$ chown -R passenger:passenger files tmp log $ chmod -R 755 files tmp log
- Assuming you run the latest stable version of Redmine (2.3.1-stable at the time of writing), you will encounter some issues with the plugin using an outdated directory structure assumption. To fix that, you need to create a symlink, which we'll remove after installation. From redmine installation root, use
$ ln -s ../plugins vendors/pluginsto create it.
- If you have not bothered with adding Ruby Enterprise to your path until now (because you simply didn't have to, you will have to add it temporarily for your terminal session, otherwise parts of it simply fail. You can do that by simply using
$ export PATH=$PATH:/opt/ree187/binwhere /opt/ree187 is the installation dir of your ruby enterprise edition.
After you've done the above, you can start the installation as describen in the plugin documentation.
In case you get trouble into trouble :
- Try running
$ ssh git@myserver infoto get a list of repos in which you have permissions. If you get nothing here, the problem is on Redmine end. If you do get here, it's on gitolite end.
- Make sure that you don't get any errors on the bottom of the plugin configuration page ( myredmine/settings/plugin/redmine_git_hosting )
- Make sure you are a member of the project
As always, I hope this helps you out - have fun with repos in Redmine!