Problems with gitosis

While working on my Ubuntu server with the Gitosis default setup, I ran into some problems along the way when trying to commit some changes:

  1. Lost ability to update the gitosis-admin repository
  2. Various python errors
  3. Expected changes to gitosis.conf file but they were not being applied

Below is a description of what I did to trace down the error(s) and try to fix them.

Gitosis debug

Setting the debug into the gitosis.conf file really helped me out. To achieve this, you must have the following in your gitosis.conf file:

loglevel = DEBUG

After this has been setup, you can run your push command to get a better idea of what is going wrong. Some of the problems I got are listed below with a explanation of what I did to try and resolve the issue:

gitosis.conf not updated after a push

This was a mystery. I cloned off the files from the gitosis-admin repo and then made some changes to the gitosis.conf file. Then after pushing them to the origin master, I noticed my changes did not take effect when looking at the file:

cat /srv/gitosis/.gitosis.conf

I noticed that there is a hook file in the directory of


with the filename of:


(Small note here, take note of the directory of where this file is because the part of /usr/share/pyshared is what you need for setting your PYTHONPATH) Running the above script occurs after applying a push to the gitosis-admin repository. I figured this was where the hold up was. After running this script manually, I got more errors (which I don’t have any more) and here is what you need to do to run this script:

sudo su
su gitosis
export set GIT_DIR="/srv/gitosis/repositories/gitosis-admin.git"
export set PYTHONPATH="/usr/share/pyshared"

That is, goto root account with sudo. Change users to gitosis. Set some variables (GIT_DIR, and PYTHONPATH). Then run script. This might give you more insight of to why the gitosis.conf file is not being updated.

Lost access to gitosis.conf file

This happened to me. Any commit I made to the gitosis-admin repo resulted in a permissions denied. So I logged on to my server, changed directories over to /srv/gitosis and edited the


file and all was okay.


Most of the time this was because the files in /srv/gitosis were not group writeable by the group of ‘gitosis’, or my account did not belong to the group ‘gitosis’, or that the ssh configuration file did not allow my account to login via ssh.


Most of the time gitosis worked great. But sometimes, it did not work out. I hope this document will save me in the future as well as others. A really nice resource for gitosis can be found at Cheers, Aaron

comments powered by Disqus