Git permissions shared server environment - mhulse/mhulse.github.io GitHub Wiki
This is totally dependent on your organization, but here’s one example:
- Create
developer
group (this is useful for non-Apache stuff) - Add the
apache
user todeveloper
group - Add user(s) to
apache
,wheel
anddeveloper
groups - Make the group of the repo
developer
(and owner can be any of the users in that group)
chgrp -R <group-name> <project_dir>/ # Change files and directories’ group
chmod -R g+w <project_dir>/ # Give write permission to the group
cd <project_dir>/ # Enter inside the project directory
git config core.fileMode false # Do not honor the executable bit of files in the working tree
git config core.sharedRepository group # Update the git's config
chmod g-w .git/objects/pack/* # Git pack files should be immutable
find -type d -exec chmod g+s {} + # New files get directory's group id
git init # Initializes the above changes