Did you run git update-server-info on the server?

If you try to setup git-http-backend for Apache and see the message:

fatal: http://example.com/prefix/path/to/repository.git/info/refs not found: 
did you run git update-server-info on the server?

and you think you did everything you could, but nothing helps, change

SetEnv GIT_HTTP_EXPORT_ALL

to

SetEnv GIT_HTTP_EXPORT_ALL 1

Why?

Usually this error message means that Apache config paths are wrong or Git URL used to clone is not correct (it is always printed by Git client if the server sends “404 Not found” response). For these settings:

SetEnv GIT_PROJECT_ROOT C:/Repositories
ScriptAlias /prefix/ "C:/Program Files/Git/libexec/git-core/git-http-backend.exe/"

and Git repository in

C:\Repositories\path\to\repository.git

Git URL will be

http://example.com/prefix/path/to/repository.git

If you use another URL, you’ll see this error message.

But this is not enough. To be able to work with the repositories you should export them, otherwise from git-http-backend’s point of view these repositories do not exist, and it sends 404 as response and prints this line to error.log

[...] Repository not exported: 'C:/Repositories/path/to/repository.git'

There’re 2 ways to “export” the repository.

  1. Create an empty file named

    C:/Repositories/path/to/repository.git/git-daemon-export-ok
    
  2. Set environment variable of git-http-backend GIT_HTTP_EXPORT_ALL using SetEnv directive. Although official Git documentation recommends to use this line

    SetEnv GIT_HTTP_EXPORT_ALL
    

    some Apache versions (at least 2.2, at least on Windows) have a bug: if the value is not specified, the environment variable is not set. As a workaround you can set it to arbitrary value, git-http-backend only checks whether the variable is set or not:

    SetEnv GIT_HTTP_EXPORT_ALL 1
    
Written on February 13, 2013