It is for bare repos and non-bare repos. There are only little differences between them, but in this way is clearer.
cd <repo.git>/ # Enter inside the git repo
git config core.sharedRepository group # Update the git's config
chgrp -R <group-name> . # Change files and directories' group
chmod -R g+w . # Change permissions
chmod g-w objects/pack/* # Git pack files should be immutable
find -type d -exec chmod g+s {} + # New files get directory's group id
where:
- <repo.git> is the bare repository directory, typically on the server (e.g. my_project.git/).
- is the group name for git users (e.g. users).
cd <project_dir>/ # Enter inside the project directory
git config core.sharedRepository group # Update the git's config
chgrp -R <group-name> . # Change files and directories' group
chmod -R g+w . # Change permissions
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
where:
- <project_dir> is the project directory containing the .git folder.
- is the group name for git users (e.g. users).