Skip to content

Commit 8127f77

Browse files
MarkLodatogitster
authored andcommitted
http-backend: add example for gitweb on same URL
In the git-http-backend documentation, add an example of how to set up gitweb and git-http-backend on the same URL by using a series of mod_alias commands. Signed-off-by: Mark Lodato <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0ebb1fa commit 8127f77

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Documentation/git-http-backend.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@ directive around the repository, or one of its parent directories:
8888
...
8989
</Location>
9090
----------------------------------------------------------------
91+
+
92+
To serve gitweb at the same url, use a ScriptAliasMatch to only
93+
those URLs that 'git-http-backend' can handle, and forward the
94+
rest to gitweb:
95+
+
96+
----------------------------------------------------------------
97+
ScriptAliasMatch \
98+
"(?x)^/git/(.*/(HEAD | \
99+
info/refs | \
100+
objects/(info/[^/]+ | \
101+
[0-9a-f]{2}/[0-9a-f]{38} | \
102+
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
103+
git-(upload|receive)-pack))$" \
104+
/usr/libexec/git-core/git-http-backend/$1
105+
106+
ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
107+
----------------------------------------------------------------
91108

92109
Accelerated static Apache 2.x::
93110
Similar to the above, but Apache can be used to return static
@@ -102,6 +119,22 @@ AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1
102119
AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1
103120
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
104121
----------------------------------------------------------------
122+
+
123+
This can be combined with the gitweb configuration:
124+
+
125+
----------------------------------------------------------------
126+
SetEnv GIT_PROJECT_ROOT /var/www/git
127+
128+
AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1
129+
AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1
130+
ScriptAliasMatch \
131+
"(?x)^/git/(.*/(HEAD | \
132+
info/refs | \
133+
objects/info/[^/]+ | \
134+
git-(upload|receive)-pack))$" \
135+
/usr/libexec/git-core/git-http-backend/$1
136+
ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
137+
----------------------------------------------------------------
105138

106139

107140
ENVIRONMENT

0 commit comments

Comments
 (0)