從你的描述中看來,問題是,你的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