Git fails to clone repo from ownCloud's webdav interface

拟墨画扇 提交于 2019-12-04 12:50:36

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.

I came across the same problem with pushing my Git repository to next cloud recently. I checked the contents of the repository and found that there was no such file info/refs there.

Researching that led me to this thread: can't clone git repos via http; info/refs not found

Executing the proposed command git update-server-info in the repository base directory created the missing file, and I did not get the 404 error anymore. So the query-string is not the problem here.

Unfortunately I get another error ("error: no DAV locking support on ..."), which is documented here https://help.nextcloud.com/t/webdav-lock-on-file-doesnt-work/21451 (with a link to a github-issue for the Nextcloud project).

Sadly, no Git repositories over WebDAV on Nextcloud yet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!