I'm using a Ubuntu box to host my bare Git repositories for developers to work off.

At the moment I'm creating a user account for each developer on the box because it doubles as a filestore and local testing server.

When somebody pushes to the bare repository other developers are unable to work on the files which change in the objects folder as a result. The new files are created with the user of the developer who pushes.

I have placed all the developers into a dev group but the umask doesn't allow the group to edit.

I've never had to set up a Git repository so haven't had experience in working with the permissions. I do want each developer to have their own user account on the test server, and I would prefer them to do actions on the server using that account. I don't mind giving them sudo rights.

Is setting the umask for each developer the way forward?


While "How do I share a Git repository with multiple users on a machine?" does address your issue (and involves setting umask for the users), I prefer adding to my git installation an authorization layer like gitolite (see its documentation).

  • No sudo right to give to anymone.
  • All git repo operations are done by one 'git' user.
  • you can set precisely the umask for newly created (and gitolite-managed) Git repos: "Setting umask in Git / Gitolite"

Make a common group, e.g. gitusers and add all developers to this group.

chown -R root:gitusers /path/to/repository.git
chmod 2775 /path/to/repository.git

You might need to change permissions recursively, e.g.:

find /path/to/repository.git -type d -exec chmod 2775 {} \;
find /path/to/repository.git -type f -exec chmod 0664 {} \;

Now all your developers should have write access to the repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.