Skip to content

Instantly share code, notes, and snippets.

@renier
Created March 7, 2012 17:14
Show Gist options
  • Save renier/1994444 to your computer and use it in GitHub Desktop.
Save renier/1994444 to your computer and use it in GitHub Desktop.
Apache configuration snippet for enabling Git's smart http support (git-http-backend)
SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
# This next is needed to enable authenticated push
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
# Above, trailing slash needed to enable pull
<LocationMatch "^/git/.*/git-receive-pack$">
Options +ExecCGI # Needed to enable push
AuthName "Protected"
AuthType basic
# ... etc. depending on the case
</LocationMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment