repo gitolite-adminRW+ = admin daemonconfig receive.denyNonFastforwards = trueconfig receive.denyDeletes = truerepo testingRW+ = @allR = daemonconfig receive.denyNonFastforwards = trueconfig receive.denyDeletes = true
<VirtualHost *:80>ServerAdmin webmaster@localhost
LogLevel debugErrorLog "|/usr/bin/cronolog /var/log/apache2/git/%Y/%W/%d-error.log"CustomLog "|/usr/bin/cronolog /var/log/apache2/git/%Y/%W/%d-access.log" combined
DocumentRoot /var/www
# Suexec setupSuexecUserGroup gitolite gitolite
# Set up appropriate GIT environmentsSetEnv GIT_PROJECT_ROOT /var/lib/gitolite/repositoriesSetEnv GIT_HTTP_EXPORT_ALLSetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
# Set up appropriate gitolite environmentsSetEnv GITOLITE_HTTP_HOME /var/lib/gitolite
# run the script to launch gitoliteScriptAlias /git/ /var/www/bin/gitolite-suexec-wrapper.sh/
# We need gl-auth-command executable<Directory "/var/www/bin"><Files "gitolite-suexec-wrapper.sh">Order allow,denyAllow from all</Files></Directory>
# Set up authentication to taste<Location />AuthType BasicAuthName "Private Git Access"Require valid-userAuthUserFile /var/lib/gitolite/http_pwd_file</Location>
<Directory />Options FollowSymLinksAllowOverride None</Directory><Directory /var/www/>Options Indexes FollowSymLinks MultiViewsAllowOverride NoneOrder allow,denyallow from all</Directory>[..]
</VirtualHost>
#!/bin/bash
## Suexec wrapper for gl-auth-command#
USER=$1
export GIT_PROJECT_ROOT="/var/lib/gitolite/repositories"export REMOTE_USER=$REDIRECT_REMOTE_USERexport GITOLITE_HTTP_HOME="/var/lib/gitolite"
# Debian Sqeeze gitolite DEB places gl-auth-command in /usr/share/gitoliteexec /usr/share/gitolite/gl-auth-command $USER
# End
host:git-test user$ git clone http://192.168.0.5/git/testing.git testing-http-git-blah
Cloning into testing-http-git-blah...
Username:
Password:
error: The requested URL returned error: 500 while accessing http://192.168.0.5/git/testing.git/info/refs
fatal: HTTP request failed
[Mon Jan 16 00:54:52 2012] [error] [client 192.168.0.2] Use of uninitialized value in do "file" at /usr/share/gitolite/gl-auth-command line 40.[Mon Jan 16 00:54:52 2012] [error] [client 192.168.0.2] Null filename used at /usr/share/gitolite/gl-auth-command line 40.[Mon Jan 16 00:54:52 2012] [error] [client 192.168.0.2] Premature end of script headers: gitolite-suexec-wrapper.sh
192.168.0.2 - admin [16/Jan/2012:00:54:52 +0100] "GET /git/testing.git/info/refs?service=git-upload-pack HTTP/1.1" 500 831 "-" "git/1.7.7"192.168.0.2 - admin [16/Jan/2012:00:54:52 +0100] "GET /git/testing.git/info/refs HTTP/1.1" 500 831 "-" "git/1.7.7"
<VirtualHost *:80>ServerAdmin webmaster@localhost
LogLevel debugErrorLog "|/usr/bin/cronolog /var/log/apache2/git/%Y/%W/%d-error.log"CustomLog "|/usr/bin/cronolog /var/log/apache2/git/%Y/%W/%d-access.log" combined
DocumentRoot /var/www
# Suexec setupSuexecUserGroup gitolite gitolite
# Set up appropriate GIT environmentsSetEnv GIT_PROJECT_ROOT /var/lib/gitolite/repositoriesSetEnv GIT_HTTP_EXPORT_ALLSetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
# Set up appropriate gitolite environments (not needed here but I left it to get like for like)SetEnv GITOLITE_HTTP_HOME /var/lib/gitolite
# We need git-http-backend executable<Directory "/var/www/bin"><Files "git-suexec-wrapper.sh">
Order allow,denyAllow from all</Files></Directory># Set up authentication to taste<Location />AuthType BasicAuthName "Private Git Access"Require valid-userAuthUserFile /var/lib/gitolite/http_pwd_file</Location>
<Directory />Options FollowSymLinksAllowOverride None</Directory><Directory /var/www/>Options Indexes FollowSymLinks MultiViewsAllowOverride NoneOrder allow,denyallow from all</Directory>[..]
</VirtualHost>
#!/bin/bash
## Suexec wrapper for git-http-backend#
# USER=$1
export GIT_PROJECT_ROOT="/var/lib/gitolite/repositories"export REMOTE_USER=$REDIRECT_REMOTE_USERexport GITOLITE_HTTP_HOME="/var/lib/gitolite"
# no comment :)exec /usr/lib/git-core/git-http-backend
# End
Cloning into testing-http-git-blah...Username:Password:remote: Counting objects: 6, done.remote: Compressing objects: 100% (3/3), done.remote: Total 6 (delta 0), reused 0 (delta 0)Unpacking objects: 100% (6/6), done.
192.168.0.2 - admin [16/Jan/2012:01:02:58 +0100] "GET /git/testing.git/info/refs?service=git-upload-pack HTTP/1.1" 200 575 "-" "git/1.7.7"192.168.0.2 - admin [16/Jan/2012:01:02:58 +0100] "POST /git/testing.git/git-upload-pack HTTP/1.1" 200 1144 "-" "git/1.7.7"
Please give your inputs to this post instead of the other. It is more complete. :)
Em
> DocumentRoot /var/www
Here I have
DocumentRoot /source/gitolite
which is where my repositories reside, but I'm not sure that this
matters.
> # Suexec setup
> SuexecUserGroup gitolite gitolite
This looks correct.
> # Set up appropriate GIT environments
> SetEnv GIT_PROJECT_ROOT /var/lib/gitolite/repositories
> SetEnv GIT_HTTP_EXPORT_ALL
> SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
>
> # Set up appropriate gitolite environments
> SetEnv GITOLITE_HTTP_HOME /var/lib/gitolite
I'm not sure that this works.
I dimly remember something that environment vars that don't start
with 'HTTP_' are removed from the environment, but I might be wrong.
But I just set everything in my suexec wrapper script...
>
> # run the script to launch gitolite
> ScriptAlias /git/ /var/www/bin/gitolite-suexec-wrapper.sh/
Which package did you install, apache2-suexec or apache2-suexec-custom?
And if the latter, what's the contents of /etc/apache2/suexec/www-data?
> # We need gl-auth-command executable
> <Directory "/var/www/bin">
> <Files "gitolite-suexec-wrapper.sh">
> Order allow,deny
> Allow from all
> </Files>
> </Directory>
I don't need this.
(I just have 'AllowOverride None' for my document root, as you have
below, to avoid annoying error logs...)
> # Set up authentication to taste
> <Location />
> AuthType Basic
> AuthName "Private Git Access"
> Require valid-user
> AuthUserFile /var/lib/gitolite/http_pwd_file
> </Location>
Mine looks different, as I use Digest (I can't use HTTPS), but it's
probably ok.
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> </Directory>
Ok.
> <Directory /var/www/>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
> Order allow,deny
> allow from all
> </Directory>
Probably ok, though I don't need any of these (as I set my DocumentRoot
to the correct location, I don't need symlinks).
> and here is /var/www/bin/gitolite-suexec-wrapper.sh:
Who's owner of that script?
>
> #!/bin/bash
>
> #
> # Suexec wrapper for gl-auth-command
> #
>
> USER=$1
>
> export GIT_PROJECT_ROOT="/var/lib/gitolite/repositories"
> export REMOTE_USER=$REDIRECT_REMOTE_USER
I'm not sure that this one works, and it's probably not required.
> export GITOLITE_HTTP_HOME="/var/lib/gitolite"
>
> # Debian Sqeeze gitolite DEB places gl-auth-command in /usr/share/gitolite
Hmmm, this reminds me that I didn't use gitolite from Debian, because
it was too old for smart HTTP support.
> exec /usr/share/gitolite/gl-auth-command $USER
Here is something similar to what I have:
#! /bin/sh
# gl-suexec-wrapper: just set env from rc file and call gl-auth-command
glhome=/var/lib/gitolite
# this is for gitweb...
export GL_BINDIR=/usr/local/bin
export GL_RC=$glhome/.gitolite.rc
export GL_REPO_BASE_ABS=/source/gitolite
export GITWEB_INDEXTEXT=$glhome/gitweb-index.html
export GITWEB_COMMAND=/usr/lib/cgi-bin/gitweb.cgi
# ... and this for "smart http" access
export GIT_PROJECT_ROOT=$GL_REPO_BASE_ABS
export GITOLITE_HTTP_HOME=$glhome
export GITOLITE_AUTH_COMMAND=/usr/local/bin/gl-auth-command
export GIT_HTTP_BACKEND="/usr/lib/git-core/git-http-backend"
exec $GITOLITE_AUTH_COMMAND "$@"
For some background it might be useful to look up the discussion
on the mailing list nearly exactly one year ago.
Detlef
Here is the apache gilolite vhost file:
<VirtualHost *:80>
DocumentRoot /var/wwwHere I have
DocumentRoot /source/gitolite
which is where my repositories reside, but I'm not sure that this
matters.
This looks correct.# Suexec setupSuexecUserGroup gitolite gitolite
I'm not sure that this works.
# Set up appropriate GIT environments
SetEnv GIT_PROJECT_ROOT /var/lib/gitolite/repositories
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
# Set up appropriate gitolite environments
SetEnv GITOLITE_HTTP_HOME /var/lib/gitolite
I dimly remember something that environment vars that don't start
with 'HTTP_' are removed from the environment, but I might be wrong.
But I just set everything in my suexec wrapper script...
Which package did you install, apache2-suexec or apache2-suexec-custom?# run the script to launch gitolite
ScriptAlias /git/ /var/www/bin/gitolite-suexec-wrapper.sh/
And if the latter, what's the contents of /etc/apache2/suexec/www-data?
I don't need this.# We need gl-auth-command executable
<Directory "/var/www/bin">
<Files "gitolite-suexec-wrapper.sh">
Order allow,deny
Allow from all
</Files>
</Directory>
(I just have 'AllowOverride None' for my document root, as you have
below, to avoid annoying error logs...)
Mine looks different, as I use Digest (I can't use HTTPS), but it's# Set up authentication to taste
<Location />
AuthType Basic
AuthName "Private Git Access"
Require valid-user
AuthUserFile /var/lib/gitolite/http_pwd_file
</Location>
probably ok.
Ok.<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
Probably ok, though I don't need any of these (as I set my DocumentRoot
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
to the correct location, I don't need symlinks).
and here is /var/www/bin/gitolite-suexec-wrapper.sh:Who's owner of that script?
I'm not sure that this one works, and it's probably not required.#!/bin/bash
#
# Suexec wrapper for gl-auth-command
#
USER=$1
export GIT_PROJECT_ROOT="/var/lib/gitolite/repositories"
export REMOTE_USER=$REDIRECT_REMOTE_USER
Hmmm, this reminds me that I didn't use gitolite from Debian, becauseexport GITOLITE_HTTP_HOME="/var/lib/gitolite"
# Debian Sqeeze gitolite DEB places gl-auth-command in /usr/share/gitolite
it was too old for smart HTTP support.
>>> export REMOTE_USER=$REDIRECT_REMOTE_**USER
>>>
>> I'm not sure that this one works, and it's probably not required.
>
>
> Probably not in the script. Just kept it there as it is deemed important
> when installing GIT with smartHTTP in
> http://stackoverflow.com/questions/3947530/git-push-fatal-failed/7177690#7177690
There they don't use suexec.
If you use suexec, REMOTE_USER is set by gl-auth-command.
Detlef