更新时间:2022-02-21 01:53:07
从您在评论中的描述看来,问题在于您的 apache
用户无法写入存储库,这在使用 git pull
时显然是必需的。你有两个行动方案:
From your description in the comments it seems that the problem is that your apache
user cannot write to the repository, which is clearly required when you use git pull
. You have two courses of action:
apache
用户可以写入它apache
user can write to it您应仔细考虑这两种选择的安全含义,但第二种选择可能最容易的。如果你还没有这样的团队,你可以用以下方式创建它:
You should think carefully about the security implications of either choice, but the second option is probably easiest. If you don't already have such a group, you can create it with:
addgroup gitwriters
...然后将自己和Apache用户添加到此组中:
... and then add yourself and the Apache user to this group:
adduser [yourusername] gitwriters
adduser apache gitwriters
另一个问题来更改存储库上的权限。重申以下几点细微差别:
Then you can follow the instructions in another question to change the permissions on the repository. To reiterate those with some slight variations:
# Recursively, set the group ownership of every file and directory of your repository:
chgrp -R gitwriters /path/to/your/repo
# Recursively, make every file and directory of your repository readable and writable
# by the group:
chmod -R g+rw /path/to/your/repo
# Recursively, set the setgid of every directory in the repository. The setgid bit
# on directories means that files created in the directory will have the same group
# ownership as the directory.
find /path/to/your/repo -type d -print0 | xargs -0 chmod g+s
然后希望你的 git pull
应该可以工作。
Then hopefully your git pull
should work.