Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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'm setting up a git server with git-http-backend and Smart HTTP but Apache doesn't seem to be calling the Smart HTTP CGI:

$ curl http://localhost/repo/myproject.git/info/refs?service=git-receive-pack
2ddf56592a0f55456b8c42dc9f2cb9289f083f53        refs/heads/1.0.x
55079bb13d9af8a9164ad0d24b654cbfe119bc7e        refs/heads/master

Here's my config:

<VirtualHost *:8000>
  ServerName localhost
  DocumentRoot /opt/local/apache2/htdocs/repo

  SetEnv GIT_PROJECT_ROOT /opt/local/apache2/htdocs/repo

  ScriptAlias /repo/ /usr/libexec/git-core/git-http-backend/
  AliasMatch ^/repo/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /opt/local/apache2/htdocs/repo/$1
  AliasMatch ^/repo/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /opt/local/apache2/htdocs/repo/$1

  ScriptAliasMatch \
    "(?x)^/repo/(.*/(HEAD | \
    info/refs | \
    objects/(info/[^/]+ | \
        [0-9a-f]{2}/[0-9a-f]{38} | \
        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
    git-(upload|receive)-pack))$" \

  <Directory "/usr/libexec/git-core/">
    Options +ExecCGI
    Allow From All

  <LocationMatch "^/repo/.*/git-receive-pack$">
    AuthType Basic
    AuthName "Git"
    Require valid-user
    AuthUserFile /etc/apache2/other/htpasswd

Here's the output of httpd -S:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:8000                 localhost (/private/etc/apache2/other/gitrepo.conf:1)
Syntax OK

And I have got http.receivepack enabled (= true) in my server-side git config:

  receivepack = true

Any ideas of what I should do?

share|improve this question
up vote 1 down vote accepted

Well, since that's in the virtualhost for :8000, I would presume you'd want to curl http:// localhost:8000/, not http:// localhost/. Beyond that, just make sure mod_cgi is enabled.

share|improve this answer
I completely forgot about the VirtualHost! Thanks! – Bo A Aug 1 '12 at 11:12

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.