Git – Setup a bare repository which is writable by both user and group

We have made the HTTP protocol works for our git repository.


We need to made the files writable by Apache otherwise you could never push the commits back to the server.

To setup a new repository, we could flag it as a shared repository during initialization. Then we could change the repository root folder.

git init --bare --shared=group <new-repo>.git
chgrp -R <group> <new-repo>.git


If that is an existing repository, we have to do a few steps more

1. Set the group.

chgrp -R <group> <existing-repo>.git


2. Flag the repository as a shared repository by editing the <existing-repo>.git/config.

        repositoryformatversion = 0
        filemode = true
        bare = true
        sharedrepository = 1

3. Make sure the <existing-repo>.git/objects is writable by the group.

chmod -R 775 objects


Done =)

Reference: StackOverflow – How to configure an existing git repo to be shared by a UNIX group


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s