Skip to content

Instantly share code, notes, and snippets.

@byplayer
Created January 19, 2012 01:17
Show Gist options
  • Save byplayer/1636976 to your computer and use it in GitHub Desktop.
Save byplayer/1636976 to your computer and use it in GitHub Desktop.
gitweb + git smart http
SetEnv GIT_PROJECT_ROOT /usr/local/var/data
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER $REDIRECT_REMOTE_USER
SetEnv GITWEB_CONFIG
<LocationMatch "^/git/.*/git-receive-pack$">
AuthType Basic
AuthName "Git Access"
# TODO LDAP Auth
AuthUserFile /usr/local/var/data/git/.htpasswd
Require valid-user
</LocationMatch>
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))$" \
"/usr/libexec/git-core/git-http-backend/$1"
# Anything not matched above goes to displayable gitweb interface
ScriptAlias /git /usr/share/gitweb/gitweb.cgi/
Alias /static/ /usr/share/gitweb/static/
<Location /git>
SSLRequireSSL
</Location>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment