@@ -41,29 +41,24 @@ http.receivepack::
4141
4242URL TRANSLATION
4343---------------
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.
4950
5051EXAMPLES
5152--------
5253
5354Apache 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:
5758+
5859----------------------------------------------------------------
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/
6762----------------------------------------------------------------
6863+
6964To enable anonymous read access but authenticated write access,
@@ -78,16 +73,16 @@ require authorization with a LocationMatch directive:
7873</LocationMatch>
7974----------------------------------------------------------------
8075+
81- To require authentication for both reads and writes, use a Directory
76+ To require authentication for both reads and writes, use a Location
8277directive around the repository, or one of its parent directories:
8378+
8479----------------------------------------------------------------
85- <Directory /var/www /git/private>
80+ <Location /git/private>
8681 AuthType Basic
8782 AuthName "Private Git Access"
8883 Require group committers
8984 ...
90- </Directory >
85+ </Location >
9186----------------------------------------------------------------
9287
9388Accelerated static Apache 2.x::
@@ -97,9 +92,9 @@ Accelerated static Apache 2.x::
9792 file contents from the file system directly to the network:
9893+
9994----------------------------------------------------------------
100- DocumentRoot /var/www
95+ SetEnv GIT_PROJECT_ROOT /var/www/git
10196
102- ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
97+ ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
10398Alias /git_static/ /var/www/git/
10499
105100RewriteEngine on
@@ -114,7 +109,7 @@ ENVIRONMENT
114109'git-http-backend' relies upon the CGI environment variables set
115110by the invoking web server, including:
116111
117- * PATH_TRANSLATED
112+ * PATH_INFO (if GIT_PROJECT_ROOT is set, otherwise PATH_TRANSLATED)
118113* REMOTE_USER
119114* REMOTE_ADDR
120115* CONTENT_TYPE
0 commit comments