在 git 上设置 umask 权限新分支

Set umask permissions new branches on git

我已经在 CentOS 8 上配置了一个新的 git 服务器。另外,我已经使用 Apache 安装了 gitlist for web repo listing。

我的问题是当我创建一个新分支时,权限设置为 rw-------- 所以 Apache 的用户无法浏览那个新分支。我一直在寻找 umask 配置,但没有找到任何东西。

我试过使用 ~/.bashrc,/etc/profile.d/git_umask.sh 没有结果。

有什么方法可以在 git 服务器上为创建的任何新分支配置 umask 吗?

首先尝试启动您的本地 Git 存储库:

git init --shared=group 

这比 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.