Create git directory

_$: mkdir -p /srv/git

Create a repository

_$: mkdir -p /srv/git/base.git
_$: cd /srv/git/base.git
_$: git init --shared=true --bare

Give permission to developers

Remember that the group for developers is called develgroup.

_$: for user in <developer 1> <developer 2> <developer N>
    usermod $user -aG develgroup

_$: chown --recursive root:develgroup  /srv/git/base.git
_$: chmod --recursive 2775             /srv/git/base.git

The permissions should be:

/srv/git/base.git                         root:develgroup 2775
/srv/git/base.git/objects                 root:develgroup 2775
/srv/git/base.git/objects/XX              user:develgroup 2775
/srv/git/base.git/objects/{info,pack}     root:develgroup 2775
/srv/git/base.git/{branches,hooks...}     root:develgroup 0775

Remove login

We will not allow developers to log into the server, they will only be able to use git. Be careful that none of these developers is also an administrator, because administrators must have ssh access to this server.

_$: for user in <developer 1> <developer 2> <developer N>
    mkdir /home/$user/git-shell-commands
    cp /usr/share/doc/git/contrib/git-shell-commands/list /home/$user/git-shell-commands/
    cp /usr/share/doc/git/contrib/git-shell-commands/help /home/$user/git-shell-commands/
    chown -R $user /home/$user/git-shell-commands
    chmod -R u+x   /home/$user/git-shell-commands

_$: which git-shell

_$: vipw