Git sharedRepository 的权限问题 [英] Permission problems with Git sharedRepository
问题描述
我正在使用 Gitolite 来管理我的 git 存储库.我还使用第三方 Web 应用程序来显示存储库.
I am using Gitolite to manage my git repositories. And I also use a third-party web application to display the repositories.
但是,每次我执行 git push --all git@myserver.com:myproject
时,第三方 Web 应用程序都无法访问存储库文件.所以我每次都需要运行 chmod go+rx -R/path/to/the/repository/folder
来查看仓库.
However each time I do a git push --all git@myserver.com:myproject
the third-party web application can not have access to the repository files. So I need to run each time chmod go+rx -R /path/to/the/repository/folder
to see the repository.
我已经设置了 git config core.sharedRepository all
但在 git push
之后仍然不记得权限.
I have set git config core.sharedRepository all
but still is not remembering the permissions after git push
.
我该如何解决这个问题?
How can I solve this problem?
推荐答案
您可以定义一个 挂钩到您的 gitolite 环境,以便从由 gitolite 管理的裸存储库更新非裸 pos(具有正确的 ACL).
You could define a hook to your gitolite environment in order to update a non-bare pos (with the right ACL) from your bare repo managed by gitolite.
只要您不使用更新
hook(在 Gitolite V3 中),您可以定义一个 post-receive
钩子,您将在其中执行这些任务.
As long as you don't use the update
hook (in Gitolite V3), you can define an post-receive
hook in which you would do those tasks.
话虽如此,还要检查 变量 REPO_UMASK
UMASK
在您的 gitolite.rc 中与此问题有任何关系:
That being said, check also if the variable REPO_UMASK
UMASK
in your gitolite.rc has any bearing on this issue:
$UMASK
,八进制,默认 0077
$UMASK
, octal, default 0077
gitolite 使用的默认 UMASK
使所有存储库及其内容具有 rwx------
权限.
想要运行 gitweb
的人意识到这行不通.
解决这个问题的正确方法是将此变量更改为 0027(这会让您获得 rwxr-x---
),然后添加运行网络服务器的 apache 或 httpd 用户作为 'gitolite 的成员' 组.
The default UMASK
that gitolite uses makes all the repos and their contents have rwx------
permissions.
People who want to run gitweb
realise that this will not do.
The correct way to deal with this is to change this variable to 0027 (which gets you rwxr-x---
), then add the apache or httpd user running the webserver as a member of the 'gitolite' group.
请注意语法;前导 0 是必需的.如果您在安装完成后更改它,您还必须做一些chmod
来调整已经创建的文件和目录的权限.
Please note the syntax; the leading 0 is required. If you change it after the install is complete, you'll have to do some chmod
's also to adjust permissions of files and directories that have already been created.
(注意:REPO_MASK
得到了 UMASK
和 GitoliteV3 或 'g3')
(Note: REPO_MASK
got UMASK
with GitoliteV3 or 'g3')
这篇关于Git sharedRepository 的权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!