gitwebdavowncloud

Git fails to clone repo from ownCloud's webdav interface


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?


Solution

  • 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.