mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-04-26 19:42:55 +08:00
40 lines
1.5 KiB
Plaintext
40 lines
1.5 KiB
Plaintext
Alias /cgit-data /usr/share/cgit
|
|
|
|
# This code is copied from the regular /git cloning code. Since our cgit
|
|
# https clones don't seem to support push, we should be able to get away with
|
|
# copying a very similar config as for /git.
|
|
|
|
# Begin http git clone
|
|
# First, deny write access
|
|
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
|
|
RewriteCond %{REQUEST_URI} /git-receive-pack$
|
|
RewriteRule ^/cgit/ - [E=AUTHREQUIRED:yes]
|
|
<Location /cgit>
|
|
<RequireAll>
|
|
Require not env AUTHREQUIRED
|
|
Require all granted
|
|
</RequireAll>
|
|
Options -Indexes +ExecCGI
|
|
</Location>
|
|
|
|
# Next up, determine which user owns this repo
|
|
SetEnvIf Request_URI ^/cgit/([a-zA-Z0-9]*)/.* GIT_PROJECT_ROOT=/home/fedora/$1/public_git
|
|
Header set X-GitProject "%{GIT_PROJECT_ROOT}e"
|
|
|
|
# Let's serve objects and packs directly from apache, very performant!
|
|
AliasMatch ^/cgit/([a-zA-Z0-9]*)/public_git/([a-zA-Z0-9]*)\.git(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /home/fedora/$1/public_git/$2.git/$3
|
|
AliasMatch ^/cgit/([a-zA-Z0-9]*)/public_git/([a-zA-Z0-9]*)\.git(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /home/fedora/$1/public_git/$2.git/$3
|
|
|
|
# And now for the magic, let's run the git cgi script
|
|
ScriptAliasMatch \
|
|
"(?x)^/cgit/([a-zA-Z0-9]*)/public_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/libexec/git-core/git-http-backend/$2
|
|
# End http git clone
|
|
|
|
ScriptAlias /cgit /var/www/cgi-bin/cgit
|