【问题标题】:Give permission for other user to git update remote?授予其他用户远程 git update 的权限?
【发布时间】:2014-11-08 22:20:45
【问题描述】:

我的 home/myuser 目录中有 git clone repo。我想授予另一个用户更新它的权限。该用户没有 sudo 权限。

git repo 在这个目录中:/home/myuser/gitrepo/

当另一个用户进入该目录并尝试更新它时:

/home/myuser/gitrepo/ git remote update

它得到这个错误: error: cannot open .git/FETCH_HEAD: Permission denied

我怎样才能让该用户访问仅更新该存储库?

【问题讨论】:

    标签: linux git permissions


    【解决方案1】:

    您可以尝试使用一个只有两个成员的组来保护您的存储库:您和另一个用户。
    见“How do I share a Git repository with multiple users on a machine?

    chgrp -R <whatever group> gitrepo
    chmod -R g+swX gitrepo
    umask 002
    

    另一种选择是确保您的系统umask得到尊重,

    git init --shared=group
    # Or, for an existing repo
    git config core.sharedRepository true
    

    最佳实践仍然是将授权委托给第三方框架,例如 gitolite,基于 ssh 守护程序或 http 服务器的身份验证。

    【讨论】:

      猜你喜欢
      • 2019-10-03
      • 1970-01-01
      • 2018-11-19
      • 1970-01-01
      • 2013-09-14
      • 1970-01-01
      • 2013-06-25
      • 2015-06-25
      • 1970-01-01
      相关资源
      最近更新 更多