Question

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?

Was it helpful?

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.

OTHER TIPS

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.

This might be more robust now: "git clone"(man) from SHA256 repository by Git built with SHA-1 as the default hash algorithm over the dumb HTTP protocol did not correctly set up the resulting repository, which has been corrected with Git 2.32 (Q2 2021, 8 years later).

See commit 00bc839 (11 May 2021) by Eric Wong (ele828).
(Merged by Junio C Hamano -- gitster -- in commit bdff041, 20 May 2021)

remote-curl: fix clone on sha256 repos

Signed-off-by: Eric Wong
Acked-by: brian m. carlson

The remote-https process needs to update it's own instance of the_repository' when it sees an HTTP(S) remote is using sha256. Without this, parse_oid_hex()fails to handle sha256 OIDs when it's eventually called byparse_fetch()`.

Tested with:

git clone https://yhbt.net/sha256test.git
GIT_SMART_HTTP=0 git clone https://yhbt.net/sha256test.git
(plain http:// also works)

Cloning the URL via git:// required no changes

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top