SetEnv GIT_PROJECT_ROOT git-repo-dir
SetEnv GIT_HTTP_EXPORT_ALL
AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /git-repo-dir/$1
AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /git-repo-dir/$1
ScriptAliasMatch \
"(?x)^/git/(.*/(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/local/libexec/git-core/git-http-backend/$1
ScriptAlias /git/ /usr/local/share/gitweb/gitweb.cgi
<Directory "git-repo-dir">
Allow from all
</Directory>
<LocationMatch "/git">
AuthType Basic
AuthName "Git"
#AuthUserFile AuthFile
#Require valid-user
AuthBasicProvider ldap
AuthLDAPURL "ldap://server:389/dc=company,dc=local?sAMAccountName?sub?(objectclass=*)" NONE
AuthLDAPBindDN "cn=user,ou=team,ou=department,dc=company,dc=local"
AuthLDAPBindPassword secret
AuthzLDAPAuthoritative on
require ldap-user user1 user2 user3
</LocationMatch>