从git-http-backend过早结束脚本标题

时间:2011-02-01 22:10:11

标签: apache git msysgit

我正在尝试在Windows上安装git和Apache。我在Windows 2008服务器(x64)上安装了MSYSGit 1.7.3。我在安装msysgit时选择了git命令应该在Windows命令提示符下工作。

我已将这些行添加到我的http.conf文件中:

SetEnv GIT_PROJECT_ROOT C:/Repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ "C:/Progra~2/git/libexec/git-core/git-http-backend.exe/"

<Directory />
  Options +ExecCGI
  Allow from all
</Directory>

我创建了一个存储库(MKE_Playground.git)。我添加了一个文件test.txt。

当我尝试访问URL http://localhost/git/MKE_Playground.git时,我在Apache日志中收到此错误:

[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Child process is running
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Acquired the start mutex.
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Starting 64 worker threads.
[Tue Feb 01 15:56:09 2011] [notice] Child 1164: Starting thread to listen on port 80.
127.0.0.1 - - [01/Feb/2011:15:56:14 -0600] "GET /git/MKE_Playground.git HTTP/1.1" 500 539
[Tue Feb 01 15:56:14 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe

我知道这意味着脚本中的标题格式不正确。如果我正在编写脚本,我会检查那里,但我认为git后端通常提供正确的标头。我对此的看法是git http后端由于某种原因失败了。我在哪里可以确定失败的原因?在某个地方有Git日志吗?

Pat O

4 个答案:

答案 0 :(得分:3)

我之前处理过类似的问题。

在Cygwin shell中运行“git-http-backend.exe”显示无法找到dll“libiconv2.dll”。该文件位于我的Git安装的git / bin目录中(主要是默认值)。我将git install的bin和libexec目录添加到我的Path中,并且能够通过Apache在本地克隆git存储库。

注意:我的Apache错误日志看起来像这样 - git-http-backend.exe在丢失的dll上失败了,但没有在httpd日志中报告:

[Mon Feb 14 15:26:02 2011] [notice] Child 3308: Starting 64 worker threads.
[Mon Feb 14 15:26:02 2011] [notice] Child 3308: Starting thread to listen on port 80.
[Mon Feb 14 15:26:20 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe
[Mon Feb 14 15:26:20 2011] [error] [client 127.0.0.1] Premature end of script headers: git-http-backend.exe

答案 1 :(得分:2)

这适用于我的1.7.6.msysgit.0设置:

http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/中,Jeremy Skinner建议必须可以在Windows cmd shell中运行Git \ libexec \ git-http-backend.exe。如果失败,请将Git \ bin \ libiconv-2.dll和Git \ bin \ libiconv2.dll复制到Git \ libexec \ git-core,然后重试。如果您可以调用git-http-backend.exe并且它为您提供“500内部服务器错误”,请尝试克隆或再次获取。

答案 2 :(得分:1)

我正在打同样的问题。在我的情况下,这是一个用户权限问题。您可以查看Apache Windows服务的“登录”信息,并与您的域用户进行测试(例如,控制面板 - &gt;管理工具 - &gt;服务 - &gt; Apache-&gt;登录标签)。

重新启动后,浏览到http://localhost/git/MKE_Playground.git应该会在error.log中向您提供“请求不支持”错误。没关系。

git clone http://localhost/git/MKE_Playground.git应该可以正常工作。

答案 3 :(得分:0)

我放弃了在Windows上运行Git的想法。因此,这不再是我的问题。

感谢您的帮助。