Fixing permissions in a shared Git repo

I hate shared Git repos’. Especially when I forget to set them as shared ones. And I start inviting people to join in on the fun.

So, therefore, here’s a tip from a blog that tells you a way of fixing the mess you did, retroactively:

tl;dr TheRightWay

git init --bare --shared

tl;dr TheRadioactiveWay

ssh server
chown -Rf root:git /path/to/bare/git/repo
cd /path/to/bare/git/repo
git config core.sharedRepository group
find /path/to/bare/git/repo -type f | xargs chmod 664
find /path/to/bare/git/repo -type d | xargs chmod 775
find /path/to/bare/git/repo -type d | xargs chmod g+s

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>