Git无法从ownCloud的webdav界面克隆回购 [英] Git fails to clone repo from ownCloud's webdav interface
问题描述
最近,我使用git 1.8.1.5版本安装Arch Linux,失败并显示以下错误消息:
致命: http://myserver.a/remote.php/webdav/repos/repo.git/info/refs?service = git-upload-pack 找不到:你是否运行git update-server -info在服务器上?
我添加了更新后的挂钩,最终它可以在我的其他机器上运行。
服务器error.log说404当git要求... info / refs?service ...
ubuntu git 1.7请求相同的url服务器。
但是,在接收到错误代码404后,它会请求... / info / refs HTTP / 1.1,并成功使用代码200.
那么为什么新版本git失败,我该如何解决它?
整个?service = ...
在任何非破坏的WebDAV实现中,IMO应该忽略它,但显然ownCloud认为它是文件名或其他内容的一部分,因此会产生错误。与ownCloud开发者讨论这个问题可能是有道理的。
在旧版本中,git回退到没有后缀的URL,但是它有它自己的问题。因此,第二个请求在1.8.0中被删除,并且引入了一个新选项,您可以使用该选项关闭智能HTTP并直接使用旧URL(这可以解决问题)。它的工作原理是这样的,例如:
GIT_SMART_HTTP = 0 git fetch
如果您从不想使用智能HTTP(但请注意,它在Github和其他任何理智的托管站点上都可以使用,如果没有它,推送将无法运行),您可以将该环境变量导出到您的shell配置文件中。
https://git.kernel.org/cgit/git/git.git/commit/?id=02572c2e3afcc200936260f48863447726212a7c 。 p>
I am having some personal git repos on my ownCloud. I can clone it from 2 ubuntu machines and a Windows PC by accessing ownClouds webdav url: http://myserver.a/remote.php/webdav/repos/repo.git
Recently I installed Arch Linux with git version 1.8.1.5 and it fails with this error message: fatal: http://myserver.a/remote.php/webdav/repos/repo.git/info/refs?service=git-upload-pack not found: did you run git update-server-info on the server?
I did add the post-update hook, eventually it works on my other machines. The servers error.log says 404 when git asks for ...info/refs?service...
The ubuntu git 1.7 requests the same url from the server. But after receiving an error code 404 it requests for .../info/refs HTTP/1.1 and succeeds with code 200.
So why does the newer git fail and how can I fix it?
The whole ?service=...
thing is for git's smart HTTP support introduced in 1.6.6. It's much more efficient than the traditional HTTP support but requires a special CGI binary to be run on the web server and does not work with WebDAV.
IMO, in any non-broken WebDAV implementation, it should be ignored, but apparently ownCloud thinks it's part of the filename or something, and so produces an error. It might make sense to talk to the ownCloud developers about this.
In older versions, git fell back to a URL without that suffix, but that had its own problems. So, the second request was removed in 1.8.0 and a new option was introduced that you can use to turn off smart HTTP and use the old URL directly (this should fix the problem). It works like this, for instance:
GIT_SMART_HTTP=0 git fetch
If you never want to use smart HTTP (but be aware that it does work on Github and every other sane hosting site, and push won't work without it there), you can export that environment variable in your shell profile.
Details about the change at https://git.kernel.org/cgit/git/git.git/commit/?id=02572c2e3afcc200936260f48863447726212a7c.
这篇关于Git无法从ownCloud的webdav界面克隆回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!