git拉钩不执行

我有这样的系统设置:

A web-focused Git workflow

但是,无论我如何configurationshell环境(即GIT_DIR和PWD),钩子调用git-pull命令时都不会运行。 从字面上看,没有任何输出。

我的后期更新如下所示:

#!/bin/sh /git/Lunch.git/lunch-receive > lunch.txt 

和我的午餐收到脚本看起来像:

 #!/bin/sh service myService stop cd /usr/lunch unset GIT_DIR git reset --hard # necessary or the pull fails git pull hub master # this line DOESN'T RUN grrrrr! chmod u+x *.sh chmod -R u+x bin service myService start 

最后,lunch.txt(输出)看起来像

 HEAD is now at 5956c0b [old commit message] 

这里有一个非常类似的问题: Git – post-receive hook用git pull“找不到有效的git目录” 。

总而言之,您需要取消设置GIT_WORK_TREE; 或者确保它确实需要,将--git-dir--work-treeparameter passing给你的git pull。

安德鲁