Git post-receive 未运行

标签 git redmine

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

真正简单的接收后 Hook ,它只是 curl 到 Redmine 以强制 Redmine 在提交时更新 repo 的 View 。 (为了调试,我还回显“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 Hook

如果我这样做 $ curl http://localhost:3000/sys/fetch_changesets?key=cGdcUaRr8u4Rr4zXzXhr 并刷新我的 redmine 问题页面它有效,万岁!

如果在推送之后我这样做:

$ ./.git/hooks/post-receive

我得到:

$ Post Receive Hook Go

成功了,万岁!

所以我知道 curl 有效,即使是 post-receive 也有效,Git 只是不触发它

这是钩子(Hook)

 $ cd .git/hooks
 $ ls -l | grep post-receive
 $ -rwxr-xr-x  1 bobbydown  staff   109 Dec 22 03:42 post-receive

我只是不明白为什么 git 没有运行钩子(Hook)...

最佳答案

在 repo 收到推送的提交后触发接收后 Hook 。

在您的场景中,您的 Hook 应该在您的 存储库中,而不是克隆中。

关于Git post-receive 未运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14001482/

相关文章:

Git:如何只列出本地分支机构?

git - 无法理解 gitignore 如何忽略文件夹

git - git push origin development和git push origin HEAD :development的区别

mysqldump 未知数据库 bitnami_redmine

mysql - Redmine 与 SQL Server 2008 R2

testing - 是否有用于集成测试的好的 redmine 插件?

Git - 删除一个 Blob

git - Git:将两个存储库彼此 merge

ruby-on-rails - mod_passenger 选项 - 无效命令

visual-studio - 使用提交注释自动关闭 Redmine 任务