Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like setup a Git server using the "Smart-HTTP" approach. However, I'm having difficulties getting it to work in Windows, and I'm new to Apache. My httpd.conf, in part:

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

    <LocationMatch "^/git/.*/git-receive-pack$">
            AuthType Basic
            AuthName "Git Access"
            Require group committers

Could someone provide the steps to setup a Git server using git-http-backend on Windows?

share|improve this question
up vote 7 down vote accepted

There are a few little details to get this working on Windows, but I've managed to do so with the following configuration:

ScriptAlias /git/ "C:/Progra~1/Git/libexec/git-core/git-http-backend.exe/"

<Directory "C:/Program Files/Git/libexec/git-core/">
  Options +ExecCGI
  Allow From All

I highly recommend watching the apache logs, and event viewer to see what is going wrong.

For example,

  • libiconv.dll can't be found. In Windows, DLL files need to exist in the $PATH, or same folder as the .exe file. Easiest fix, is to copy the file.
  • In Apache, permissions need to be set to run the executable (ExecCGI option).

Now, to continue debugging, here are a few pointers.

The easiest way to monitor the apache logs is by opening the "Git bash" shell, and running the following command:

tail -f /c/Program\ Files/Apache\ Software\ Foundation/Apache2.2/logs/{access,error}.log &

You can enter this command and path using TAB completion, and press 2x TAB to get a list of suggestions. The & at the end turns it into a background process. Each time you make a request, or restart apache, the new log lines will scroll through your screen.

The tail process can be stopped by using either:

jobs         # See the background jobs
kill %1      # Kill the specific process


fg           # Bring the first job in the foreground
Ctrl+C       # Kill the foreground process

Don't try to open the git URL in your browser, that won't work. Instead, in the same GIT Bash shell, run the git clone command. e.g.:

git clone http://localhost/git/somefolder.git

...and you'll see the logs scroll by indicating where things went wrong.

Since the git-http-backend does not provide any HTML frontend, I can wholeheartedly recommend gitphp for this (note there are multiple projects called almost the same). It's easy to setup, and built with msysGit support in mind too. This should give you a nice web interface to browse all available repositories.

I get problems with spaces in the git folder, these are best to avoid.

Cloning the HTTP url requires at least msysGit 1.7.1 if you like to remember passwords. The passwords can be stored in a _netrc file, in your profile folder (%USERPROFILE%) with the following layout:

machine login MyAccount password MyPassword

Alternatively, you can specify the credentials in the clone URL, but this will break submodules.

Footnote: When your server also supports IIS 7 and .NET 4, you may also want to look at or These projects provide a HTTP-backend for Git, based on .NET. I haven't been able to use these tools, because the server still runs Windows 2003.

share|improve this answer


I'm having difficulties getting it to work in Windows

  1. What difficulties?
  2. "in Windows" means from GNU/Linux it works fine?

You should also attach logs of apache and git, the version of git to make the problem easier to track down.


The config file looks fine for me at the first glance. Try to remove the authentication requirement and test without it first.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.