【问题标题】:git object folder permissiongit 对象文件夹权限
【发布时间】:2013-02-11 12:26:57
【问题描述】:

我正在尝试将 trac 与 git 挂钩,大多数都很好,除了一些存储库,我无法从 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

我可以知道是什么原因造成的吗?非常感谢

【问题讨论】:

  • 随机猜测:可能是umask 问题?
  • 对不起,我不明白。我应该如何验证或确认是否是 umask 问题?
  • 您是否使用 gitolite 来管理对您的存储库的访问权限?
  • @VonC:是的,没错。
  • @Walty 我已经编辑了我的答案以包括 Gitolite 的 umask 细节。

标签: git file-permissions trac


【解决方案1】:

您需要检查执行 track daemon 的用户是否与 git 用户在同一组中。

考虑一下installation process

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

任何由 git 创建的带有 umask 027 的文件仍然可以被 trac 读取。

如果您使用 gitolite,如 mentioned here,则需要将 .gitolite.rc 中的 umask 设置为 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,

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-11-07
  • 2011-08-12
  • 1970-01-01
  • 2018-09-19
相关资源
最近更新 更多