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: https://blog.christophersmart.com/2014/01/10/permanently-fixing-permissions-on-a-shared-git-repo/

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


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

If you’d like to utilise the power of Webmentions do the following:
1: Create a post or something as a response to this one and make sure that the response contains this posts permalink URL (protip: copy and paste it from your browser)
3: Copy and paste the URL from your response in the field below and click Ping Me! 3: Wait for the moderation gnomes to do their work.
4: Done!