3

我在这里搜索了几个问题并没有得到答案,所以我将询问我的具体情况。

真正简单的 post-receive 钩子,它只是卷曲到 Redmine 以强制 Redmine 在提交时更新 repo 的视图。(为了调试,我也在回显“Post Receive Hook Go”以查看

设置:裸仓库 /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

我得到:

$ 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没有运行钩子......

4

1 回答 1

1

The post-receive hook fires after a repo receives pushed commits.

In your scenario, your hook should be in your bare repo, not the clone.

于 2012-12-22T09:39:00.940 回答