【问题标题】:Git post-receive Not runningGit post-receive 没有运行
【发布时间】:2012-12-22 08:59:42
【问题描述】:

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

真正简单的 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 没有运行钩子......

【问题讨论】:

    标签: git redmine


    【解决方案1】:

    在 repo receives 推送提交后触发 post-receive 钩子。

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

    【讨论】:

    • @John - 你说的裸仓库是什么意思?
    • @Darius.V 通常(就像在这个问题中一样)一个裸仓库是服务器端的,它没有工作树。看看git-scm.com/book/en/v2/…
    • 我发现了 post-receive 不运行的问题。这是因为我的服务器就像客户端,而比特桶或像这样的服务器是服务器端。由于我无法访问 bitbucket linux 服务器,因此我无法运行 post-receive。但相反,我使用了合并后,我可以把它放在我的服务器上,一旦收到文件——它们被合并,所以钩子运行。合并后属于客户端类别。
    猜你喜欢
    • 2012-01-02
    • 2013-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-02
    • 2017-10-19
    • 2010-11-24
    相关资源
    最近更新 更多