为什么http协议要推送服务器,Git智能HTTP协议无法在推送时执行服务器端挂钩

我正在尝试使用git-http-backend设置智能HTTP。我试图在网上关注如何做到这一点的大量文档/指南。我在Windows 7上运行的Apache 2.4在我的httpd.conf我有Git智能HTTP协议无法在推送时执行服务器端挂钩

SetEnv GIT_PROJECT_ROOT c:/repos

SetEnv GIT_HTTP_EXPORT_ALL

ScriptAlias /git/ "c:/program files/git/mingw64/libexec/git-core/git-http-backend.exe/"

Require all granted

Require all granted

对于C:\repos,我确信每个人都具有完全访问权限。我在我的用户帐户下运行httpd.exe,因此对服务器的请求应该在PATH上看到git 2.12.2。

在C:\repos,我有一个名为foo.git的裸回购。在回购里面我做git config http.receivepack true。我能够用http://localhost/git/foo.git克隆得很好。 没有启用服务器端钩子,我能够推送一个提交就好了。

现在恼人的一部分 - 我创建一个更新挂钩,只是C:\repos\foo.git\hooks\update包含以下内容:

#!/bin/bash

echo foo

exit 0

我尝试从本地回购推动,并得到

Counting objects: 3, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 315 bytes | 315.00 KiB/s, done.

Total 3 (delta 0), reused 0 (delta 0)

To http://localhost/git/foo.git

! [remote rejected] master -> master (pre-receive hook declined)

error: failed to push some refs to 'http://localhost/git/foo.git'

好了,我尝试用git协议推动同样的事情 - 我运行了git daemon --reuseaddr --base-path=C:\repos C:\repos。然后我在foo.git里放了一个git-daemon-export-ok。我回到当地的回购协议,并推到git:///foo.git:

Counting objects: 3, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 315 bytes | 35.00 KiB/s, done.

Total 3 (delta 0), reused 0 (delta 0)

remote: foo

To git:///foo.git

3b33593..6af841c master -> master

一切顺利。我推动文件协议 - file:///c/repos/foo.git,这工作也没关系。

我试着在我的httpd.conf做

Require all granted

,以确保它没有任何关系与访问问题。当然,我将它切换回Require all denied。

基于详细的推送,似乎git-receive-pack无法在服务器端启动bash解释器,但我不知道为什么。同样,它是从我的用户帐户下运行的httpd.exe产生的,我可以手动执行git。再次,git可以在PATH上找到。我在这里错过了什么样的明显解决方案?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值