我的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
我怎样才能让该用户访问只更新该回购?
答案 0 :(得分:2)
您可以尝试使用只有两个成员的组来保护您的回购:您和另一个用户 请参阅" 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
另一个选项是确保使用
来检查您的系统umaskgit init --shared=group
# Or, for an existing repo
git config core.sharedRepository true
最佳做法仍然是根据ssh守护程序或http服务器的身份验证,将授权委托给第三方框架,如gitolite。