git对象文件夹权限

时间:2013-02-26 06:15:25

标签: git file-permissions trac

我试图用git挂钩trac,大多数都没问题,除了SOME存储库,我无法从git中获取修订信息。

完成以下操作后,Trac

正确收集了修订版
chmod -R 777 <git-repo>/objects/

(我知道777非常危险,只是出于诊断目的)

但是,对于那些新提交,提交的项目仍然是0700许可。

drwxrwxrwx 2 git git 4.0K 2013-02-26 10:49 80
drwxrwxrwx 2 git git 4.0K 2013-02-26 10:49 0a
drwxrwxrwx 2 git git 4.0K 2013-02-26 11:01 04
drwxrwxrwx 2 git git 4.0K 2013-02-26 11:01 a6
drwxrwxrwx 2 git git 4.0K 2013-02-26 11:01 61
drwxrwxrwx 2 git git 4.0K 2013-02-26 11:01 2f
drwx------ 2 git git 4.0K 2013-02-26 12:13 da
drwx------ 2 git git 4.0K 2013-02-26 12:13 a3
drwx------ 2 git git 4.0K 2013-02-26 12:13 8c
drwx------ 2 git git 4.0K 2013-02-26 12:13 26

但最奇怪的是,对于同一台机器中的其他一些git存储库,这些新的对象文件夹大部分都是755权限(对于Trac来说仍然没问题)。

drwxr-xr-x 2 git git 4.0K 2011-07-12 17:22 14
drwxr-xr-x 2 git git 4.0K 2011-07-12 17:22 f5
drwxr-xr-x 2 git git 4.0K 2011-07-12 17:22 9e
drwxr-xr-x 2 git git 4.0K 2013-02-26 14:12 aa
drwx------ 2 git git 4.0K 2013-02-26 14:12 76
drwxr-xr-x 2 git git 4.0K 2013-02-26 14:12 44
drwxr-xr-x 2 git git 4.0K 2013-02-26 14:12 c5
drwxr-xr-x 2 git git 4.0K 2013-02-26 14:12 9c
drwx------ 2 git git 4.0K 2013-02-26 14:12 6a

我可以知道可能导致这种情况的原因吗?非常感谢

1 个答案:

答案 0 :(得分:1)

您需要检查执行跟踪守护程序的用户是否与git用户位于同一个组中。

考虑这个installation process

useradd -m -K UMASK=027 git
useradd -m -K UMASK=077 -G git trac

git使用umask 027创建的任何文件仍然可以被trac读取。

如果您使用gitolite作为mentioned here,则需要将umask中的.gitolite.rc设置为0027,以允许群组具有读取权限。
请参阅Rc.pm,默认情况下它是077而不是027:

# HELP for all the other external programs (the syntactic sugar helpers and
# the various programs/functions in the 8 trigger lists), can be found in
# doc/non-core.mkd (http://sitaramc.github.com/gitolite/non-core.html) or in
# the corresponding source file itself.

%RC = (
    # if you're using mirroring, you need a hostname. This is *one* simple
    # word, not a full domain name. See documentation if in doubt
    # HOSTNAME => 'darkstar',
    UMASK => 0077,