@@ -41,29 +41,24 @@ http.receivepack::
41
41
42
42
URL TRANSLATION
43
43
---------------
44
- 'git-http-backend' relies on the invoking web server to perform
45
- URL to path translation, and store the repository path into the
46
- PATH_TRANSLATED environment variable. Most web servers will do
47
- this translation automatically, resolving the suffix after the
48
- CGI name relative to the server's document root.
44
+ To determine the location of the repository on disk, 'git-http-backend'
45
+ concatenates the environment variables PATH_INFO, which is set
46
+ automatically by the web server, and GIT_PROJECT_ROOT, which must be set
47
+ manually in the web server configuration. If GIT_PROJECT_ROOT is not
48
+ set, 'git-http-backend' reads PATH_TRANSLATED, which is also set
49
+ automatically by the web server.
49
50
50
51
EXAMPLES
51
52
--------
52
53
53
54
Apache 2.x::
54
- To serve all Git repositories contained within the '/git/'
55
- subdirectory of the DocumentRoot, ensure mod_cgi and
56
- mod_alias are enabled, and create a ScriptAlias to the CGI:
55
+ Ensure mod_cgi, mod_alias, and mod_env are enabled, set
56
+ GIT_PROJECT_ROOT (or DocumentRoot) appropriately, and
57
+ create a ScriptAlias to the CGI:
57
58
+
58
59
----------------------------------------------------------------
59
- ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
60
-
61
- <Directory /usr/libexec/git-core>
62
- Options None
63
- </Directory>
64
- <Files /usr/libexec/git-core/git-http-backend>
65
- Options ExecCGI
66
- </Files>
60
+ SetEnv GIT_PROJECT_ROOT /var/www/git
61
+ ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
67
62
----------------------------------------------------------------
68
63
+
69
64
To enable anonymous read access but authenticated write access,
@@ -78,16 +73,16 @@ require authorization with a LocationMatch directive:
78
73
</LocationMatch>
79
74
----------------------------------------------------------------
80
75
+
81
- To require authentication for both reads and writes, use a Directory
76
+ To require authentication for both reads and writes, use a Location
82
77
directive around the repository, or one of its parent directories:
83
78
+
84
79
----------------------------------------------------------------
85
- <Directory /var/www /git/private>
80
+ <Location /git/private>
86
81
AuthType Basic
87
82
AuthName "Private Git Access"
88
83
Require group committers
89
84
...
90
- </Directory >
85
+ </Location >
91
86
----------------------------------------------------------------
92
87
93
88
Accelerated static Apache 2.x::
@@ -97,9 +92,9 @@ Accelerated static Apache 2.x::
97
92
file contents from the file system directly to the network:
98
93
+
99
94
----------------------------------------------------------------
100
- DocumentRoot /var/www
95
+ SetEnv GIT_PROJECT_ROOT /var/www/git
101
96
102
- ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
97
+ ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
103
98
Alias /git_static/ /var/www/git/
104
99
105
100
RewriteEngine on
@@ -114,7 +109,7 @@ ENVIRONMENT
114
109
'git-http-backend' relies upon the CGI environment variables set
115
110
by the invoking web server, including:
116
111
117
- * PATH_TRANSLATED
112
+ * PATH_INFO (if GIT_PROJECT_ROOT is set, otherwise PATH_TRANSLATED)
118
113
* REMOTE_USER
119
114
* REMOTE_ADDR
120
115
* CONTENT_TYPE
0 commit comments