从你的描述中看来,问题是,你的apache
用户不能写入仓库的意见,这在使用git pull
时显然是必需的。你有两项行动:
- 安装Apache才能运行该脚本作为另一个用户(例如,使用suEXEC要么on a VirtualHost or via userdir)
- 变化你的资料库中的权限,这样
apache
用户可以写入
您应该仔细考虑任一选择的安全影响,但第二种选择可能是最简单的。如果你还没有这样一个小组,你可以创建它:
addgroup gitwriters
...然后自己和Apache用户添加到该组:
adduser [yourusername] gitwriters
adduser apache gitwriters
然后你就可以按照another question中的说明更改存储库的权限。重申那些有一些细微的变化:
# 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
应该工作。
'git pull'的输出是什么?你有没有试过'git pull origin master'或者你的分支/遥控器的名字是什么? – Artefact2 2011-02-28 15:45:32
你好...'git pull'不会遗漏任何东西,'git pull origin master'也不会 - 很奇怪。 – williamsowen 2011-02-28 15:50:05
您提到的另一个问题的答案是存在权限问题,这似乎是合理的,因为'git log'和'git status'不需要写入存储库,而'git pull'会。为了研究这一点,我会将你的'git pull'改为'touch/tmp/whatever',然后使用'ls -l/tmp/whatever'来找到拥有这个文件的用户和组 - 这会告诉你用户是什么'shell_exec'命令正在运行。如果你不能以该用户的身份写入存储库目录,那么这就可以解释为什么'git pull'失败...... – 2011-02-28 16:05:44