git-http-backend 的脚本标头过早结束

发布于 2024-10-15 08:30:16 字数 1281 浏览 5 评论 0原文

我正在尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

沫尐诺 2024-10-22 08:30:16

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

在 Cygwin shell 中运行“git-http-backend.exe”显示找不到 dll“libiconv2.dll”。该文件位于我的 Git 安装的 git/bin 目录中(大部分是默认值)。我将 git 安装的 bin 和 libexec 目录添加到我的路径中,并且能够通过 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

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:

[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
梦魇绽荼蘼 2024-10-22 08:30:16

这适用于我的 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.

情魔剑神 2024-10-22 08:30:16

我正在解决同样的问题。就我而言,这是一个用户权限问题。您可以检查 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.

找回味觉 2024-10-22 08:30:16

我已经放弃了在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文