blob: e4ca219edfaebf1e9bfd788ee3f02bebc9dc8b21 [file] [log] [blame]
Junio C Hamano3b70d3c2009-11-21 17:37:371<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6<meta name="generator" content="AsciiDoc 8.2.5" />
7<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
19a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
26
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
47h1, h2, h3 {
48 border-bottom: 2px solid silver;
49}
50h2 {
51 padding-top: 0.5em;
52}
53h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
59
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
84}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
152div.listingblock {
153 margin-right: 0%;
154}
155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
164
165div.attribution {
166 text-align: right;
167}
168div.verseblock + div.attribution {
169 text-align: left;
170}
171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
214div.olist2 ol {
215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
219 border: 3px solid #527bbd;
220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
233div.hlist td {
234 padding-bottom: 5px;
235}
236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
306</style>
307<title>git-http-backend(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-http-backend(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-http-backend -
317 Server side implementation of Git over HTTP
318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
323<div class="verseblock">
Junio C Hamano1aa40d22010-01-21 17:46:43324<div class="content"><em>git http-backend</em></div></div>
Junio C Hamano3b70d3c2009-11-21 17:37:37325</div>
326<h2 id="_description">DESCRIPTION</h2>
327<div class="sectionbody">
328<div class="para"><p>A simple CGI program to serve the contents of a Git repository to Git
329clients accessing the repository over http:// and https:// protocols.
Junio C Hamano167b1382010-01-31 23:04:31330The program supports clients fetching using both the smart HTTP protocol
Junio C Hamano3b70d3c2009-11-21 17:37:37331and the backwards-compatible dumb HTTP protocol, as well as clients
332pushing using the smart HTTP protocol.</p></div>
Junio C Hamano6ce6b6c2010-01-18 01:25:50333<div class="para"><p>It verifies that the directory has the magic file
334"git-daemon-export-ok", and it will refuse to export any git directory
335that hasn't explicitly been marked for export this way (unless the
336GIT_HTTP_EXPORT_ALL environmental variable is set).</p></div>
Junio C Hamano3b70d3c2009-11-21 17:37:37337<div class="para"><p>By default, only the <tt>upload-pack</tt> service is enabled, which serves
Junio C Hamano1aa40d22010-01-21 17:46:43338<em>git fetch-pack</em> and <em>git ls-remote</em> clients, which are invoked from
339<em>git fetch</em>, <em>git pull</em>, and <em>git clone</em>. If the client is authenticated,
340the <tt>receive-pack</tt> service is enabled, which serves <em>git send-pack</em>
341clients, which is invoked from <em>git push</em>.</p></div>
Junio C Hamano3b70d3c2009-11-21 17:37:37342</div>
343<h2 id="_services">SERVICES</h2>
344<div class="sectionbody">
345<div class="para"><p>These services can be enabled/disabled using the per-repository
346configuration file:</p></div>
347<div class="vlist"><dl>
348<dt>
349http.getanyfile
350</dt>
351<dd>
352<p>
353 This serves older Git clients which are unable to use the
354 upload pack service. When enabled, clients are able to read
355 any file within the repository, including objects that are
356 no longer reachable from a branch but are still present.
357 It is enabled by default, but a repository can disable it
358 by setting this configuration item to <tt>false</tt>.
359</p>
360</dd>
361<dt>
362http.uploadpack
363</dt>
364<dd>
365<p>
Junio C Hamano1aa40d22010-01-21 17:46:43366 This serves <em>git fetch-pack</em> and <em>git ls-remote</em> clients.
Junio C Hamano3b70d3c2009-11-21 17:37:37367 It is enabled by default, but a repository can disable it
368 by setting this configuration item to <tt>false</tt>.
369</p>
370</dd>
371<dt>
372http.receivepack
373</dt>
374<dd>
375<p>
Junio C Hamano1aa40d22010-01-21 17:46:43376 This serves <em>git send-pack</em> clients, allowing push. It is
Junio C Hamano3b70d3c2009-11-21 17:37:37377 disabled by default for anonymous users, and enabled by
378 default for users authenticated by the web server. It can be
379 disabled by setting this item to <tt>false</tt>, or enabled for all
380 users, including anonymous users, by setting it to <tt>true</tt>.
381</p>
382</dd>
383</dl></div>
384</div>
385<h2 id="_url_translation">URL TRANSLATION</h2>
386<div class="sectionbody">
Junio C Hamano1aa40d22010-01-21 17:46:43387<div class="para"><p>To determine the location of the repository on disk, <em>git http-backend</em>
Junio C Hamano3b70d3c2009-11-21 17:37:37388concatenates the environment variables PATH_INFO, which is set
389automatically by the web server, and GIT_PROJECT_ROOT, which must be set
390manually in the web server configuration. If GIT_PROJECT_ROOT is not
Junio C Hamano1aa40d22010-01-21 17:46:43391set, <em>git http-backend</em> reads PATH_TRANSLATED, which is also set
Junio C Hamano3b70d3c2009-11-21 17:37:37392automatically by the web server.</p></div>
393</div>
394<h2 id="_examples">EXAMPLES</h2>
395<div class="sectionbody">
396<div class="para"><p>All of the following examples map <em>http://$hostname/git/foo/bar.git</em>
397to <em>/var/www/git/foo/bar.git</em>.</p></div>
398<div class="vlist"><dl>
399<dt>
400Apache 2.x
401</dt>
402<dd>
403<p>
404 Ensure mod_cgi, mod_alias, and mod_env are enabled, set
405 GIT_PROJECT_ROOT (or DocumentRoot) appropriately, and
406 create a ScriptAlias to the CGI:
407</p>
408<div class="listingblock">
409<div class="content">
410<pre><tt>SetEnv GIT_PROJECT_ROOT /var/www/git
Junio C Hamano6ce6b6c2010-01-18 01:25:50411SetEnv GIT_HTTP_EXPORT_ALL
Junio C Hamano3b70d3c2009-11-21 17:37:37412ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/</tt></pre>
413</div></div>
414<div class="para"><p>To enable anonymous read access but authenticated write access,
415require authorization with a LocationMatch directive:</p></div>
416<div class="listingblock">
417<div class="content">
418<pre><tt>&lt;LocationMatch "^/git/.*/git-receive-pack$"&gt;
419 AuthType Basic
420 AuthName "Git Access"
421 Require group committers
422 ...
423&lt;/LocationMatch&gt;</tt></pre>
424</div></div>
425<div class="para"><p>To require authentication for both reads and writes, use a Location
426directive around the repository, or one of its parent directories:</p></div>
427<div class="listingblock">
428<div class="content">
429<pre><tt>&lt;Location /git/private&gt;
430 AuthType Basic
431 AuthName "Private Git Access"
432 Require group committers
433 ...
434&lt;/Location&gt;</tt></pre>
435</div></div>
436<div class="para"><p>To serve gitweb at the same url, use a ScriptAliasMatch to only
Junio C Hamano1aa40d22010-01-21 17:46:43437those URLs that <em>git http-backend</em> can handle, and forward the
Junio C Hamano3b70d3c2009-11-21 17:37:37438rest to gitweb:</p></div>
439<div class="listingblock">
440<div class="content">
441<pre><tt>ScriptAliasMatch \
442 "(?x)^/git/(.*/(HEAD | \
443 info/refs | \
444 objects/(info/[^/]+ | \
445 [0-9a-f]{2}/[0-9a-f]{38} | \
446 pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
447 git-(upload|receive)-pack))$" \
448 /usr/libexec/git-core/git-http-backend/$1
449
450ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/</tt></pre>
451</div></div>
452</dd>
453<dt>
454Accelerated static Apache 2.x
455</dt>
456<dd>
457<p>
458 Similar to the above, but Apache can be used to return static
459 files that are stored on disk. On many systems this may
460 be more efficient as Apache can ask the kernel to copy the
461 file contents from the file system directly to the network:
462</p>
463<div class="listingblock">
464<div class="content">
465<pre><tt>SetEnv GIT_PROJECT_ROOT /var/www/git
466
467AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1
468AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1
469ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/</tt></pre>
470</div></div>
471<div class="para"><p>This can be combined with the gitweb configuration:</p></div>
472<div class="listingblock">
473<div class="content">
474<pre><tt>SetEnv GIT_PROJECT_ROOT /var/www/git
475
476AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1
477AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1
478ScriptAliasMatch \
479 "(?x)^/git/(.*/(HEAD | \
480 info/refs | \
481 objects/info/[^/]+ | \
482 git-(upload|receive)-pack))$" \
483 /usr/libexec/git-core/git-http-backend/$1
484ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/</tt></pre>
485</div></div>
486</dd>
487</dl></div>
488</div>
489<h2 id="_environment">ENVIRONMENT</h2>
490<div class="sectionbody">
Junio C Hamano1aa40d22010-01-21 17:46:43491<div class="para"><p><em>git http-backend</em> relies upon the CGI environment variables set
Junio C Hamano3b70d3c2009-11-21 17:37:37492by the invoking web server, including:</p></div>
493<div class="ilist"><ul>
494<li>
495<p>
496PATH_INFO (if GIT_PROJECT_ROOT is set, otherwise PATH_TRANSLATED)
497</p>
498</li>
499<li>
500<p>
501REMOTE_USER
502</p>
503</li>
504<li>
505<p>
506REMOTE_ADDR
507</p>
508</li>
509<li>
510<p>
511CONTENT_TYPE
512</p>
513</li>
514<li>
515<p>
516QUERY_STRING
517</p>
518</li>
519<li>
520<p>
521REQUEST_METHOD
522</p>
523</li>
524</ul></div>
Junio C Hamano6ce6b6c2010-01-18 01:25:50525<div class="para"><p>The GIT_HTTP_EXPORT_ALL environmental variable may be passed to
526<em>git-http-backend</em> to bypass the check for the "git-daemon-export-ok"
527file in each repository before allowing export of that repository.</p></div>
Junio C Hamano3b70d3c2009-11-21 17:37:37528<div class="para"><p>The backend process sets GIT_COMMITTER_NAME to <em>$REMOTE_USER</em> and
529GIT_COMMITTER_EMAIL to <em>${REMOTE_USER}@http.${REMOTE_ADDR}</em>,
530ensuring that any reflogs created by <em>git-receive-pack</em> contain some
531identifying information of the remote user who performed the push.</p></div>
532<div class="para"><p>All CGI environment variables are available to each of the hooks
533invoked by the <em>git-receive-pack</em>.</p></div>
534</div>
535<h2 id="_author">Author</h2>
536<div class="sectionbody">
537<div class="para"><p>Written by Shawn O. Pearce &lt;spearce@spearce.org&gt;.</p></div>
538</div>
539<h2 id="_documentation">Documentation</h2>
540<div class="sectionbody">
541<div class="para"><p>Documentation by Shawn O. Pearce &lt;spearce@spearce.org&gt;.</p></div>
542</div>
543<h2 id="_git">GIT</h2>
544<div class="sectionbody">
545<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
546</div>
547<div id="footer">
548<div id="footer-text">
Junio C Hamanodca34822010-02-13 01:02:52549Last updated 2010-02-13 00:59:45 UTC
Junio C Hamano3b70d3c2009-11-21 17:37:37550</div>
551</div>
552</body>
553</html>