You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

56 lines
2.0 KiB

##
## cgit.conf -- cgit Apache configuration
##
# configure the Git repository root directory
SetEnv GIT_PROJECT_ROOT @l_prefix@/var/cgit/repo
# export all repositories under the root directory
SetEnv GIT_HTTP_EXPORT_ALL
# "fast lane" for static content
AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ @l_prefix@/var/cgit/repo/$1
AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ @l_prefix@/var/cgit/repo/$1
# the git-upload-pack service serves "git fetch-pack" and "git
# ls-remote" clients, which are invoked from "git fetch", "git pull",
# and "git clone". The "git-receive-pack" serves "git send-pack"
# clients, which is invoked from "git push".
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))$" \
@l_prefix@/libexec/git/git-http-backend/$1
# everything else is served via cgit, which allows you to browse
# directory trees at arbitrary revisions, view contents of files
# (blobs), see log or shortlog of a given branch, examine commits,
# commit messages and changes made by a given commit.
ScriptAlias \
/git/ \
@l_prefix@/cgi/cgit.cgi/
# allow cgit to find its own files
Alias /cgit/ @l_prefix@/share/cgit/
# access control for read/write access
<LocationMatch "^/git">
AuthType Basic
AuthName "Git Read-Access"
AuthUserFile @l_prefix@/etc/cgit/cgit.passwd
AuthGroupFile @l_prefix@/etc/cgit/cgit.groups
Require group git-reader
</LocationMatch>
# access control for write access (overrides above)
<LocationMatch "^/git/.*/git-receive-pack$">
AuthType Basic
AuthName "Git Write-Access"
AuthUserFile @l_prefix@/etc/cgit/cgit.passwd
AuthGroupFile @l_prefix@/etc/cgit/cgit.groups
Require group git-writer
</LocationMatch>