git-http-backend 的脚本标头过早结束
我正在尝试在 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 日志吗?
帕特奥
I am attempting to install git and Apache on Windows. I have installed MSYSGit 1.7.3 on my Windows 2008 server (x64). I selected that the git commands should work from a Windows command prompt when I installed msysgit.
I have added these lines to my http.conf file:
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>
I created a repository (MKE_Playground.git). I added a file test.txt.
When I attempt to access the URL http://localhost/git/MKE_Playground.git I get this error in the Apache log:
[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
I know that this means that the headers from the script were malformed. If I were writing the script I would check there, but I assume that the git backend typically provides correct headers. My take on this is that the git http backend failed for some reason. Where can I go to determine why it failed? Is there a Git log someplace?
Pat O
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我之前处理过类似的问题。
在 Cygwin shell 中运行“git-http-backend.exe”显示找不到 dll“libiconv2.dll”。该文件位于我的 Git 安装的 git/bin 目录中(大部分是默认值)。我将 git 安装的 bin 和 libexec 目录添加到我的路径中,并且能够通过 Apache 在本地克隆 git 存储库。
注意:我的 Apache 错误日志如下所示 - git-http-backend.exe 在缺少 dll 上失败,但未在 httpd 日志中报告这一点:
I dealt with a similar problem earlier.
Running "git-http-backend.exe" in a Cygwin shell revealed that the dll, "libiconv2.dll" could not be found. The file is located in the git/bin directory for my Git install (mostly defaults). I added the bin and libexec directories of the git install to my Path, and was able to clone the git repository locally through Apache.
Note: My Apache error logs looked like this - git-http-backend.exe was failing on the missing dll, but not reporting that in the httpd logs:
这适用于我的 1.7.6.msysgit.0 设置:
在 http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/,杰里米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 内部服务器错误”,请尝试克隆或再次获取。
This worked for my 1.7.6.msysgit.0 setup:
In http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/, Jeremy Skinner suggests that it must be possible to run Git\libexec\git-http-backend.exe in a Windows cmd shell. When this fails, copy Git\bin\libiconv-2.dll and Git\bin\libiconv2.dll to Git\libexec\git-core and try again. If you can call git-http-backend.exe and it gives you a "500 Internal Server Error", try your clone or fetch again.
我正在解决同样的问题。就我而言,这是一个用户权限问题。您可以检查 Apache Windows 服务的“登录”信息,并使用您的域用户进行测试(控制面板 -> 管理工具 -> 服务 -> Apache -> 登录选项卡)。
重新启动后,浏览到 http://localhost/git/MKE_Playground.git 应该会给你一个error.log 中出现请求不支持的错误。没关系。
git clone http://localhost/git/MKE_Playground.git 应该可以工作。
I was fighting the same issue. In my case it was a user permission problem. You can check the "log on" information for the Apache Windows Service and test with your domain user for instance (Control Panel->Administrative Tools->Services->Apache->Log On Tab).
After a reboot, browsing to your http://localhost/git/MKE_Playground.git should then give you a Request not supported error in your error.log. That's fine.
git clone http://localhost/git/MKE_Playground.git should work then.
我已经放弃了在 Windows 上运行 Git 的想法。因此,这对我来说不再是问题。
感谢您的帮助。
I have abandonded the idea of running Git on Windows. As such this is no longer an issue for me.
Thanks for your help.