我在这里搜索了几个问题,但没有找到答案,因此我会根据我的具体情况提问。
真的很简单的post-receive钩子,只需要将其弯曲到Redmine上,以强制Redmine在提交时更新存储库的视图。(为了调试起见,我还echo “Post Receive Hook Go”)
设置: Bare Repo /git/repos/test.git
这会正常提交和推送,但是post-receive钩子不触发。 如果我执行以下命令:
真的很简单的post-receive钩子,只需要将其弯曲到Redmine上,以强制Redmine在提交时更新存储库的视图。(为了调试起见,我还echo “Post Receive Hook Go”)
设置: Bare Repo /git/repos/test.git
$ cd ~/
$ git clone file:///git/repos/test.git
$ cd test/
$ vim somefile_gets_updated
$ git commit -a -m 'Tackling bug #1, include the bug number so Redmine will pick it up and associate it'
$ git push origin master
这会正常提交和推送,但是post-receive钩子不触发。 如果我执行以下命令:
$ curl http://localhost:3000/sys/fetch_changesets?key=cGdcUaRr8u4Rr4zXzXhr
并刷新我的Redmine问题页面,它就能够工作了,太好了!
如果在推送后我执行以下操作:$ ./.git/hooks/post-receive
I get:
$ Post Receive Hook Go
太好了,它可以工作!
所以我知道curl是可行的,即使post-receive也可以工作,但是Git却没有触发它。
这就是钩子。
$ cd .git/hooks
$ ls -l | grep post-receive
$ -rwxr-xr-x 1 bobbydown staff 109 Dec 22 03:42 post-receive
我就是不明白为什么 git 没有运行这个钩子...