mandrake mandrake - 4 months ago 23
Git Question

`git clone` over "dumb" http protocol fails with `repository not found`

My question

I'm trying to share a git repo on our company intranet server using the dumb http protocol, which should only require file access, but it fails with

fatal: repository 'http://my-url/repo.git' not found

But pasting the same link in Firefox gives me the index to the bare repo with
etc. All directories and files are readable.
In fact, if I download the whole thing recursively with wget I could
git clone
locally from that, so all required files seems accessible without issues.

$ wget -r --no-parent --reject "index.html*" http://my-url/repo.git
$ git clone repo.git test
Cloning into 'test'...

Continuing the debugging I tried verbose output with

$ GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone http://my-url/repo.git test
trace: built-in: git 'clone' 'http://my-url/repo.git' 'test'
Cloning into 'test'...
trace: run_command: 'git-remote-http' 'origin' 'http://my-url/repo.git'
* Couldn't find host my-url in the .netrc file; using defaults
* About to connect() to my-url port 80 (#0)
* Trying <ip>...
* Connected to my-url (<ip>) port 80 (#0)
> GET /repo.git/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/
Host: my-url
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

< HTTP/1.1 404 Not Found
< Date: Fri, 04 Sep 2015 13:41:56 GMT
< Server: Apache/2.2.15 (Red hat)
< shortcut-icon: /images/logo.ico
< Content-Length: 346
< Content-Type: text/html; charset=iso-8859-1
< X-Cache: MISS from my-url
* Connection #0 to host my-url left intact
fatal: repository 'http://my-host/repo.git/' not found

And to me it looks like it gives up after trying the "smart" http protocol. So, what's going on? From what I've been able to gather the dumb http protocol hasn't been dropped. Why does
give up after trying the smart http?


  • HTTP Server is Apache 2.2.15

  • Anonymous read access via HTTP is allowed

  • git version

  • The repo is bare and is not symlinked

  • git update-server-info
    has manually been called.

  • I don't have access to the server and can't configure it, so the "smart http" option is out.

  • The only thing in any (global, system, local) git-config is

  • env | grep GIT
    is empty

  • The results are the same for

Updated with results for https (same)

Similar questions

Similar question but without answers that are helpful in this case:
Git Clone - Repository not found

Also similar, but the accepted answer uses "smart http" protocol.
git clone
over HTTP Fails with “repository not found”


TL;DR: Manually provide option to disable "smart" http protocol:

$ GIT_SMART_HTTP=0 git clone http://my-dumb-http-server/repo.git

But according to

If the server does not respond with a Git HTTP smart service, the Git client will try to fall back to the simpler “dumb” HTTP protocol.

This does not seem to be the case for some reason. But after digging around in the code I saw that they check for GIT_SMART_HTTP environment variable and I got git clone working by setting GIT_SMART_HTTP=0.