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 am following this tutorial to setup gitolite and at some point the following ScriptAliasMatch is used:

ScriptAliasMatch \
"(?x)^/(.*/(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))$" \

And the target script starts with


So I am guessing this is used to forward the user name from apache to the suexec script (which indeed requires it). But I cannot see how this is done. The ScriptAliasMatch documentation makes me think that the /$1 will be replaced by the first matching group of the regexp before it. For me it captures from (?x)^/(.* to ))$ so there is nothing about a user here.

My underlying problem is that USER is empty in my script so I get no authorizations in gitolite. I give my username to apache via a basic authentication:

<Location />
   # Crowd auth 
   AuthType Basic
   AuthName "Git repositories"
   Require valid-user

defined just under the previous ScriptAliasMatch.

So I am really wondering how this is supposed to work and what part of the mechanism I missed so that I don't retrieve the user in my script.

share|improve this question
up vote 1 down vote accepted

I found the solution following and which was to add the


to my apache configuration and use $REMOTE_USER in my script which contains indeed the authenticated user name. I'm really wondering how the sample in the tutorial is supposed to work.

share|improve this answer
Good catch. +1. I never had to set explicitly REMOTE_USER in all my Apache-Git config (for gitolite, or gitweb, or cgit, ...):…, probably because I didn't had to redirect to a cgi ( – VonC Sep 28 '12 at 12:30

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.