Redmine, Gitosis, Passenger on CentOS/RHEL 6
I recently had to install Redmine for a set of projects some friends and I are working on. We wanted a place to track issues and whatnot, and Redmine seemed like a fairly good fit.
I followed the Wiki to set it up, made a ‘redmine’ group, added ‘gitosis’ and ‘apache’ to it.
However, after adding the repo in Redmine, I went to the repository tab and was disheartened when I saw: “The entry or revision was not found in the repository”.
At first I assumed something like SELinux was blocking it, but the issue was still there after setting SELinux to Permissive.
I did some log searching and found a lot of:
fatal: Not a git repository: ‘/var/lib/gitosis/repositories/PROJECT.git’
fatal: Not a git repository: ‘/var/lib/gitosis/repositories/PROJECT.git’
fatal: Not a git repository: ‘/var/lib/gitosis/repositories/PROJECT.git’
fatal: Not a git repository: ‘/var/lib/gitosis/repositories/PROJECT.git’
After doing lots of research, I realized that Passenger doesn’t necessarily run as the ‘apache’ user. I gave ‘apache’ permissions to the repo, but it turns out that Passenger runs as whatever user config/environment.rb belongs to.
Well this wasn’t good for my setup, but luckily all I had to do was force Passenger to run as the apache user.
My Redmine virtualhost block now looks like this:
<VirtualHost *:80> ServerName redmine.myproject.org DocumentRoot /srv/web/redmine/public RailsEnv production PassengerUser apache </VirtualHost>