Autogenerated HTML docs for v1.7.2.3-392-g02377
[git/jnareb-git.git] / git-http-backend.html
bloba73fe6ad90d12388b8808eb6e25acb18ab5da66d
1 <!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 */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, 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;
47 h1, h2, h3 {
48 border-bottom: 2px solid silver;
50 h2 {
51 padding-top: 0.5em;
53 h3 {
54 float: left;
56 h3 + * {
57 clear: left;
60 div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
65 hr {
66 border: 1px solid silver;
69 p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
74 pre {
75 padding: 0;
76 margin: 0;
79 span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
85 span#email {
87 span#revision {
88 font-family: sans-serif;
91 div#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;
98 div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
102 div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
107 div#preamble,
108 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110 div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
115 div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
120 div.content { /* Block element content. */
121 padding: 0;
124 /* Block element titles. */
125 div.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;
132 div.title + * {
133 margin-top: 0;
136 td div.title:first-child {
137 margin-top: 0.0em;
139 div.content div.title:first-child {
140 margin-top: 0.0em;
142 div.content + div.title {
143 margin-top: 0.0em;
146 div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
152 div.listingblock {
153 margin-right: 0%;
155 div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
161 div.quoteblock > div.content {
162 padding-left: 2.0em;
165 div.attribution {
166 text-align: right;
168 div.verseblock + div.attribution {
169 text-align: left;
172 div.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;
180 div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
185 div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
190 div.verseblock div.content {
191 white-space: pre;
194 div.imageblock div.content { padding-left: 0; }
195 div.imageblock img { border: 1px solid silver; }
196 span.image img { border-style: none; }
198 dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
202 dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
207 dd > *:first-child {
208 margin-top: 0;
211 ul, ol {
212 list-style-position: outside;
214 div.olist2 ol {
215 list-style-type: lower-alpha;
218 div.tableblock > table {
219 border: 3px solid #527bbd;
221 thead {
222 font-family: sans-serif;
223 font-weight: bold;
225 tfoot {
226 font-weight: bold;
229 div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
233 div.hlist td {
234 padding-bottom: 5px;
236 td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
241 td.hlist2 {
242 vertical-align: top;
245 @media print {
246 div#footer-badges { display: none; }
249 div#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;
258 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
262 div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
266 div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
270 div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
274 include1::./stylesheets/xhtml11-manpage.css[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
282 div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
289 div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
295 div.quoteblock-content {
296 padding-left: 2.0em;
299 div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc a:visited { color: blue; }
306 </style>
307 <title>git-http-backend(1)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 git-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">
324 <div class="content"><em>git http-backend</em></div></div>
325 </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
329 clients accessing the repository over http:// and https:// protocols.
330 The program supports clients fetching using both the smart HTTP protocol
331 and the backwards-compatible dumb HTTP protocol, as well as clients
332 pushing using the smart HTTP protocol.</p></div>
333 <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
335 that hasn't explicitly been marked for export this way (unless the
336 GIT_HTTP_EXPORT_ALL environmental variable is set).</p></div>
337 <div class="para"><p>By default, only the <tt>upload-pack</tt> service is enabled, which serves
338 <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,
340 the <tt>receive-pack</tt> service is enabled, which serves <em>git send-pack</em>
341 clients, which is invoked from <em>git push</em>.</p></div>
342 </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
346 configuration file:</p></div>
347 <div class="vlist"><dl>
348 <dt>
349 http.getanyfile
350 </dt>
351 <dd>
353 This serves Git clients older than version 1.6.6 that 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>
362 http.uploadpack
363 </dt>
364 <dd>
366 This serves <em>git fetch-pack</em> and <em>git ls-remote</em> clients.
367 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>
372 http.receivepack
373 </dt>
374 <dd>
376 This serves <em>git send-pack</em> clients, allowing push. It is
377 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">
387 <div class="para"><p>To determine the location of the repository on disk, <em>git http-backend</em>
388 concatenates the environment variables PATH_INFO, which is set
389 automatically by the web server, and GIT_PROJECT_ROOT, which must be set
390 manually in the web server configuration. If GIT_PROJECT_ROOT is not
391 set, <em>git http-backend</em> reads PATH_TRANSLATED, which is also set
392 automatically 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>
397 to <em>/var/www/git/foo/bar.git</em>.</p></div>
398 <div class="vlist"><dl>
399 <dt>
400 Apache 2.x
401 </dt>
402 <dd>
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
411 SetEnv GIT_HTTP_EXPORT_ALL
412 ScriptAlias /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,
415 require 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
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
426 directive 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
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
437 those URLs that <em>git http-backend</em> can handle, and forward the
438 rest 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
450 ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/</tt></pre>
451 </div></div>
452 </dd>
453 <dt>
454 Accelerated static Apache 2.x
455 </dt>
456 <dd>
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
467 AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1
468 AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1
469 ScriptAlias /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
476 AliasMatch ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/www/git/$1
477 AliasMatch ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/www/git/$1
478 ScriptAliasMatch \
479 "(?x)^/git/(.*/(HEAD | \
480 info/refs | \
481 objects/info/[^/]+ | \
482 git-(upload|receive)-pack))$" \
483 /usr/libexec/git-core/git-http-backend/$1
484 ScriptAlias /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">
491 <div class="para"><p><em>git http-backend</em> relies upon the CGI environment variables set
492 by the invoking web server, including:</p></div>
493 <div class="ilist"><ul>
494 <li>
496 PATH_INFO (if GIT_PROJECT_ROOT is set, otherwise PATH_TRANSLATED)
497 </p>
498 </li>
499 <li>
501 REMOTE_USER
502 </p>
503 </li>
504 <li>
506 REMOTE_ADDR
507 </p>
508 </li>
509 <li>
511 CONTENT_TYPE
512 </p>
513 </li>
514 <li>
516 QUERY_STRING
517 </p>
518 </li>
519 <li>
521 REQUEST_METHOD
522 </p>
523 </li>
524 </ul></div>
525 <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"
527 file in each repository before allowing export of that repository.</p></div>
528 <div class="para"><p>The backend process sets GIT_COMMITTER_NAME to <em>$REMOTE_USER</em> and
529 GIT_COMMITTER_EMAIL to <em>${REMOTE_USER}@http.${REMOTE_ADDR}</em>,
530 ensuring that any reflogs created by <em>git-receive-pack</em> contain some
531 identifying 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
533 invoked 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">
549 Last updated 2010-09-03 21:30:20 UTC
550 </div>
551 </div>
552 </body>
553 </html>