Git推送HTTP不激活远程钩子

Bra*_*tie 6 git webdav

在我的远程盒子上,我初始化了一个裸git存储库.在hooks目录中,我使用以下脚本初始化了post-receive,post-update和update hooks:

#!/bin/bash
echo $0 $@ >> /tmp/githooks.log
Run Code Online (Sandbox Code Playgroud)

在我的本地方框中,我克隆了存储库,添加了一个测试文件,提交了它并将更改推回到远程框中.

$ git clone https://remote/git/sandbox.git sandbox
$ cd sandbox
$ touch asdf
$ git add asdf
$ git commit -a
[master (root-commit) 37505de] zxcv
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 asdf
$ git push origin master
Fetching remote heads...
  refs/
  refs/heads/
  refs/tags/
updating 'refs/heads/master'
  from 0000000000000000000000000000000000000000
  to   37505de9c22b0aee84e0071190f4f58728770675
    sending 3 objects
    done
Updating remote server info
To https://remote/git/sandbox.git
 * [new branch]      master -> master
Run Code Online (Sandbox Code Playgroud)

但是,/ tmp/githooks.log在远程计算机上为空.但是,如果我在远程计算机上克隆存储库,则会成功调用挂钩.

git hook不能用于http-push吗?

Von*_*onC 8

使用Git协议,您将启用不同的功能.
对于HTTP,此线程总结了该问题:

这里的"问题"(这与HTTP协议的设计方式非常相似)是,它不是git,它在推送时更新远程端的存储库(知道挂钩),而是通过WebDAV更新Web服务器.
而且Web服务器对钩子一无所知.

当"智能"HTTP协议实现时(当前处于设计阶段,我认为只是在设计协议之后),这可能会得到改善.

正如您所评论的,智能http就是答案.

替代文字

此功能称为"智能"HTTP与"哑"HTTP,因为它需要在服务器上安装Git二进制文件,之前的HTTP传输只需要一个简单的Web服务器.
它与客户进行真正的对话,而不仅仅是愚蠢地推出数据.