Search code examples
gitcentosbranchumask

Set umask permissions new branches on git


I've configured a new git server on CentOS 8. Also, I've installed gitlist for web repo listing using Apache.

My problem is when I create a new branch, permissions are set to rw------- so Apache's user is unable to browse that new branch. I've been looking for umask configuration but I didn't found anything.

I've tried using ~/.bashrc, /etc/profile.d/git_umask.sh with no results.

Is there any way to configure umask on git server for any new branch created?


Solution

  • Try first to initiate your local Git repo with:

    git init --shared=group 
    

    That would be more reliable than umask.

    git init --shared:

    Specify that the Git repository is to be shared amongst several users.
    This allows users belonging to the same group to push into that repository.

    When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.
    When not specified, Git will use permissions reported by umask.