Skip to content

Git permissions shared server environment

Michael Hulse edited this page Jul 19, 2019 · 3 revisions

Workflow example

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 to developer group
  • Add user(s) to apache, wheel and developer groups
  • Make the group of the repo developer (and owner can be any of the users in that group)

Code example

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
Clone this wiki locally