How to use group file permissions correctly on a git repository? How to use group file permissions correctly on a git repository? unix unix

How to use group file permissions correctly on a git repository?


An existing repository that has not been created with --shared can be turned shared using following commands:

# make the repository sharedgit config core.sharedRepository group # or whatever other sharing option# fix the setgid bitfind . -type d | xargs chmod g+s# repair the permissionschmod -R g+r *


You need to set the setgid bit on the group as well.

chgrp -R GROUP /path/to/repofind /path/to/repo -type d -print0 | xargs -0 chmod g+s 


Is this a bare repo? If its a bare repo and you used --shared when you created it then this shouldn't be happening which is why I'm asking.

If it is a bare repo maybe some of the directories got changed to g-s, if that happened you need to either chmod g+x all the directories only, make sure you don't do it to any files. An easier way than that might be to just git init --bare --shared=group a new repo and push the content back to it from somebodies clone.