1
刚刚在我的网络服务器上安装了gitolite
,我试图获得一个post-receive
钩子,它可以指向git dir
的apache方向。post-receive hook权限被拒绝“无法创建文件”错误
这就是我的post-receive
挂钩的样子。从Using Git to manage a web site得到了这个脚本。
#!/bin/sh
echo "post-receive example.com triggered"
GIT_WORK_TREE=/srv/sites/example.com/public git checkout -f
我也试过:
#!/bin/sh
echo "post-receive example.com triggered"
unset GIT_INDEX_FILE
export GIT_WORK_TREE=/srv/sites/example.com/public
export GIT_DIR=/home/git/repositories/example.com.git
git checkout -f
这是错误响应我获得了来自本地工作站取回从git push origin master
。这些是来自我的存储库中的文件。
remote: post-receive example.com triggered
remote: error: unable to create file .htaccess (Permission denied)
remote: error: unable to create file .tm_sync.config (Permission denied)
remote: fatal: cannot create directory at 'application': Permission denied
独立脚本错误
remote: sudo: no tty present and no askpass program specified
remote: Sorry, try again.
remote: sudo: no tty present and no askpass program specified
remote: Sorry, try again.
remote: sudo: no tty present and no askpass program specified
remote: Sorry, try again.
remote: sudo: 3 incorrect password attempts
更新:
[email protected]:~$ sudo -l
Matching Defaults entries for git on this host:
env_reset, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User git may run the following commands on this host:
(root) NOPASSWD: /usr/local/sbin/prgetsimpleappscom
[email protected]:~$ /usr/local/sbin/prgetsimpleappscom
-su: /usr/local/sbin/prgetsimpleappscom: Permission denied
[email protected]:~$ sh /usr/local/sbin/prgetsimpleappscom
post-receive getsimpleapps.com triggered
error: unable to unlink old 'application/config/development/database.php' (Permission denied)
error: unable to unlink old 'application/config/production/database.php' (Permission denied)
error: unable to unlink old 'application/config/quickbooks.php' (Permission denied)
[email protected]:~$ sudo sh /usr/local/sbin/prgetsimpleappscom
[sudo] password for git:
Sorry, user git is not allowed to execute '/bin/sh /usr/local/sbin/prgetsimpleappscom' as root on vannevar.
[email protected]:~$ sudo /usr/local/sbin/prgetsimpleappscom
[sudo] password for git:
sudo: /usr/local/sbin/prgetsimpleappscom: command not found
[email protected]:~$ nano /usr/local/sbin/prgetsimpleappscom
[email protected]:~$
请问您的'git-daemon'(或者'gitolite'服务于相同目的的任何内容)运行的userid是否具有'/ srv/sites/example.com/public'中的写入权限并且有权覆盖可能已经存在的内容在那里? – twalberg
我感觉很傻。不,它是根源:根。我会尝试运行一个'chown git:git public /'? – ThomasReggi
哇,它的工作=/ – ThomasReggi