We're having permission problem with Git on FreeBSD. The setup is fairly straight forward. We have a few different repos on the same server. For simplicity, let's say they reside in /git/repo1 and /git/repo2.
Each repo is owned by the user 'git' and a self-titled group (eg. repo1). The repo is configured with g+rwX access.
Every user who commits to the repository is also member of the group for the repo (eg. repo1).
The Git repositories all have 'sharedRepository = group' set.
So far so good, all users can check out the code from the repositories, and the first user can commit without any problem. However, when the next user tries to commit to the repositories, he will receive a permission error.
We've been banging our heads with this issue for some time now, and the only way we've managed to resolve it is by running the following script between commits (which is obviously very inconvenient):
find /git/repo1 -type d -exec chmod g+s {} \;
chmod -R g+rwX /git/repo1
chown -R git:repo1 /git/repo1/
cd /git/repo1
git gc
Anyone got a clue to where the problem lies?
Off the top of my head, possibly a umask issue?
Have you considered wrapping git with gitosis (http://vafer.org/blog/20080115011413)? I've found it a much more pleasant way of working with Git (no permissions headaches since the repo is owned by one OS user), and the permissions you can implement using gitosis are an attractive bonus.
When you create a new repository, set the group ownership of the folder, and give it a sticky bit:
chown git:repo1 /git/repo1
chmod g+ws /git/repo1
Also make sure your each user has the correct umask. You can set the default umask in /etc/login.conf. Look for the line under :default that looks like:
:umask=002:
Change it to:
:umask=022:
And run:
sudo cap_mkdb /etc/login.conf