Autogenerated HTML docs for v1.7.1
[git/jnareb-git.git] / git-daemon.html
blob7b5980b7c22431acbf6e7c4e4e83b31085d93354
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-daemon(1)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 git-daemon(1) Manual Page
313 </h1>
314 <h2>NAME</h2>
315 <div class="sectionbody">
316 <p>git-daemon -
317 A really simple server for git repositories
318 </p>
319 </div>
320 </div>
321 <h2>SYNOPSIS</h2>
322 <div class="sectionbody">
323 <div class="verseblock">
324 <div class="content"><em>git daemon</em> [--verbose] [--syslog] [--export-all]
325 [--timeout=n] [--init-timeout=n] [--max-connections=n]
326 [--strict-paths] [--base-path=path] [--base-path-relaxed]
327 [--user-path | --user-path=path]
328 [--interpolated-path=pathtemplate]
329 [--reuseaddr] [--detach] [--pid-file=file]
330 [--enable=service] [--disable=service]
331 [--allow-override=service] [--forbid-override=service]
332 [--inetd | [--listen=host_or_ipaddr] [--port=n] [--user=user [--group=group]]
333 [directory&#8230;]</div></div>
334 </div>
335 <h2 id="_description">DESCRIPTION</h2>
336 <div class="sectionbody">
337 <div class="para"><p>A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
338 aka 9418. It waits for a connection asking for a service, and will serve
339 that service if it is enabled.</p></div>
340 <div class="para"><p>It verifies that the directory has the magic file "git-daemon-export-ok", and
341 it will refuse to export any git directory that hasn't explicitly been marked
342 for export this way (unless the <em>--export-all</em> parameter is specified). If you
343 pass some directory paths as <em>git daemon</em> arguments, you can further restrict
344 the offers to a whitelist comprising of those.</p></div>
345 <div class="para"><p>By default, only <tt>upload-pack</tt> service is enabled, which serves
346 <em>git fetch-pack</em> and <em>git ls-remote</em> clients, which are invoked
347 from <em>git fetch</em>, <em>git pull</em>, and <em>git clone</em>.</p></div>
348 <div class="para"><p>This is ideally suited for read-only updates, i.e., pulling from
349 git repositories.</p></div>
350 <div class="para"><p>An <tt>upload-archive</tt> also exists to serve <em>git archive</em>.</p></div>
351 </div>
352 <h2 id="_options">OPTIONS</h2>
353 <div class="sectionbody">
354 <div class="vlist"><dl>
355 <dt>
356 --strict-paths
357 </dt>
358 <dd>
360 Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
361 "/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
362 <em>git daemon</em> will refuse to start when this option is enabled and no
363 whitelist is specified.
364 </p>
365 </dd>
366 <dt>
367 --base-path=path
368 </dt>
369 <dd>
371 Remap all the path requests as relative to the given path.
372 This is sort of "GIT root" - if you run <em>git daemon</em> with
373 <em>--base-path=/srv/git</em> on example.com, then if you later try to pull
374 <em>git://example.com/hello.git</em>, <em>git daemon</em> will interpret the path
375 as <em>/srv/git/hello.git</em>.
376 </p>
377 </dd>
378 <dt>
379 --base-path-relaxed
380 </dt>
381 <dd>
383 If --base-path is enabled and repo lookup fails, with this option
384 <em>git daemon</em> will attempt to lookup without prefixing the base path.
385 This is useful for switching to --base-path usage, while still
386 allowing the old paths.
387 </p>
388 </dd>
389 <dt>
390 --interpolated-path=pathtemplate
391 </dt>
392 <dd>
394 To support virtual hosting, an interpolated path template can be
395 used to dynamically construct alternate paths. The template
396 supports %H for the target hostname as supplied by the client but
397 converted to all lowercase, %CH for the canonical hostname,
398 %IP for the server's IP address, %P for the port number,
399 and %D for the absolute path of the named repository.
400 After interpolation, the path is validated against the directory
401 whitelist.
402 </p>
403 </dd>
404 <dt>
405 --export-all
406 </dt>
407 <dd>
409 Allow pulling from all directories that look like GIT repositories
410 (have the <em>objects</em> and <em>refs</em> subdirectories), even if they
411 do not have the <em>git-daemon-export-ok</em> file.
412 </p>
413 </dd>
414 <dt>
415 --inetd
416 </dt>
417 <dd>
419 Have the server run as an inetd service. Implies --syslog.
420 Incompatible with --port, --listen, --user and --group options.
421 </p>
422 </dd>
423 <dt>
424 --listen=host_or_ipaddr
425 </dt>
426 <dd>
428 Listen on a specific IP address or hostname. IP addresses can
429 be either an IPv4 address or an IPv6 address if supported. If IPv6
430 is not supported, then --listen=hostname is also not supported and
431 --listen must be given an IPv4 address.
432 Incompatible with <em>--inetd</em> option.
433 </p>
434 </dd>
435 <dt>
436 --port=n
437 </dt>
438 <dd>
440 Listen on an alternative port. Incompatible with <em>--inetd</em> option.
441 </p>
442 </dd>
443 <dt>
444 --init-timeout=n
445 </dt>
446 <dd>
448 Timeout between the moment the connection is established and the
449 client request is received (typically a rather low value, since
450 that should be basically immediate).
451 </p>
452 </dd>
453 <dt>
454 --timeout=n
455 </dt>
456 <dd>
458 Timeout for specific client sub-requests. This includes the time
459 it takes for the server to process the sub-request and the time spent
460 waiting for the next client's request.
461 </p>
462 </dd>
463 <dt>
464 --max-connections=n
465 </dt>
466 <dd>
468 Maximum number of concurrent clients, defaults to 32. Set it to
469 zero for no limit.
470 </p>
471 </dd>
472 <dt>
473 --syslog
474 </dt>
475 <dd>
477 Log to syslog instead of stderr. Note that this option does not imply
478 --verbose, thus by default only error conditions will be logged.
479 </p>
480 </dd>
481 <dt>
482 --user-path
483 </dt>
484 <dt>
485 --user-path=path
486 </dt>
487 <dd>
489 Allow &#126;user notation to be used in requests. When
490 specified with no parameter, requests to
491 git://host/&#126;alice/foo is taken as a request to access
492 <em>foo</em> repository in the home directory of user <tt>alice</tt>.
493 If <tt>--user-path=path</tt> is specified, the same request is
494 taken as a request to access <tt>path/foo</tt> repository in
495 the home directory of user <tt>alice</tt>.
496 </p>
497 </dd>
498 <dt>
499 --verbose
500 </dt>
501 <dd>
503 Log details about the incoming connections and requested files.
504 </p>
505 </dd>
506 <dt>
507 --reuseaddr
508 </dt>
509 <dd>
511 Use SO_REUSEADDR when binding the listening socket.
512 This allows the server to restart without waiting for
513 old connections to time out.
514 </p>
515 </dd>
516 <dt>
517 --detach
518 </dt>
519 <dd>
521 Detach from the shell. Implies --syslog.
522 </p>
523 </dd>
524 <dt>
525 --pid-file=file
526 </dt>
527 <dd>
529 Save the process id in <em>file</em>. Ignored when the daemon
530 is run under <tt>--inetd</tt>.
531 </p>
532 </dd>
533 <dt>
534 --user=user
535 </dt>
536 <dt>
537 --group=group
538 </dt>
539 <dd>
541 Change daemon's uid and gid before entering the service loop.
542 When only <tt>--user</tt> is given without <tt>--group</tt>, the
543 primary group ID for the user is used. The values of
544 the option are given to <tt>getpwnam(3)</tt> and <tt>getgrnam(3)</tt>
545 and numeric IDs are not supported.
546 </p>
547 <div class="para"><p>Giving these options is an error when used with <tt>--inetd</tt>; use
548 the facility of inet daemon to achieve the same before spawning
549 <em>git daemon</em> if needed.</p></div>
550 </dd>
551 <dt>
552 --enable=service
553 </dt>
554 <dt>
555 --disable=service
556 </dt>
557 <dd>
559 Enable/disable the service site-wide per default. Note
560 that a service disabled site-wide can still be enabled
561 per repository if it is marked overridable and the
562 repository enables the service with a configuration
563 item.
564 </p>
565 </dd>
566 <dt>
567 --allow-override=service
568 </dt>
569 <dt>
570 --forbid-override=service
571 </dt>
572 <dd>
574 Allow/forbid overriding the site-wide default with per
575 repository configuration. By default, all the services
576 are overridable.
577 </p>
578 </dd>
579 <dt>
580 &lt;directory&gt;
581 </dt>
582 <dd>
584 A directory to add to the whitelist of allowed directories. Unless
585 --strict-paths is specified this will also include subdirectories
586 of each named directory.
587 </p>
588 </dd>
589 </dl></div>
590 </div>
591 <h2 id="_services">SERVICES</h2>
592 <div class="sectionbody">
593 <div class="para"><p>These services can be globally enabled/disabled using the
594 command line options of this command. If a finer-grained
595 control is desired (e.g. to allow <em>git archive</em> to be run
596 against only in a few selected repositories the daemon serves),
597 the per-repository configuration file can be used to enable or
598 disable them.</p></div>
599 <div class="vlist"><dl>
600 <dt>
601 upload-pack
602 </dt>
603 <dd>
605 This serves <em>git fetch-pack</em> and <em>git ls-remote</em>
606 clients. It is enabled by default, but a repository can
607 disable it by setting <tt>daemon.uploadpack</tt> configuration
608 item to <tt>false</tt>.
609 </p>
610 </dd>
611 <dt>
612 upload-archive
613 </dt>
614 <dd>
616 This serves <em>git archive --remote</em>. It is disabled by
617 default, but a repository can enable it by setting
618 <tt>daemon.uploadarch</tt> configuration item to <tt>true</tt>.
619 </p>
620 </dd>
621 <dt>
622 receive-pack
623 </dt>
624 <dd>
626 This serves <em>git send-pack</em> clients, allowing anonymous
627 push. It is disabled by default, as there is _no_
628 authentication in the protocol (in other words, anybody
629 can push anything into the repository, including removal
630 of refs). This is solely meant for a closed LAN setting
631 where everybody is friendly. This service can be
632 enabled by <tt>daemon.receivepack</tt> configuration item to
633 <tt>true</tt>.
634 </p>
635 </dd>
636 </dl></div>
637 </div>
638 <h2 id="_examples">EXAMPLES</h2>
639 <div class="sectionbody">
640 <div class="vlist"><dl>
641 <dt>
642 We assume the following in /etc/services
643 </dt>
644 <dd>
645 <div class="listingblock">
646 <div class="content">
647 <pre><tt>$ grep 9418 /etc/services
648 git 9418/tcp # Git Version Control System</tt></pre>
649 </div></div>
650 </dd>
651 <dt>
652 <em>git daemon</em> as inetd server
653 </dt>
654 <dd>
656 To set up <em>git daemon</em> as an inetd service that handles any
657 repository under the whitelisted set of directories, /pub/foo
658 and /pub/bar, place an entry like the following into
659 /etc/inetd all on one line:
660 </p>
661 <div class="listingblock">
662 <div class="content">
663 <pre><tt> git stream tcp nowait nobody /usr/bin/git
664 git daemon --inetd --verbose --export-all
665 /pub/foo /pub/bar</tt></pre>
666 </div></div>
667 </dd>
668 <dt>
669 <em>git daemon</em> as inetd server for virtual hosts
670 </dt>
671 <dd>
673 To set up <em>git daemon</em> as an inetd service that handles
674 repositories for different virtual hosts, <tt>www.example.com</tt>
675 and <tt>www.example.org</tt>, place an entry like the following into
676 <tt>/etc/inetd</tt> all on one line:
677 </p>
678 <div class="listingblock">
679 <div class="content">
680 <pre><tt> git stream tcp nowait nobody /usr/bin/git
681 git daemon --inetd --verbose --export-all
682 --interpolated-path=/pub/%H%D
683 /pub/www.example.org/software
684 /pub/www.example.com/software
685 /software</tt></pre>
686 </div></div>
687 <div class="para"><p>In this example, the root-level directory <tt>/pub</tt> will contain
688 a subdirectory for each virtual host name supported.
689 Further, both hosts advertise repositories simply as
690 <tt>git://www.example.com/software/repo.git</tt>. For pre-1.4.0
691 clients, a symlink from <tt>/software</tt> into the appropriate
692 default repository could be made as well.</p></div>
693 </dd>
694 <dt>
695 <em>git daemon</em> as regular daemon for virtual hosts
696 </dt>
697 <dd>
699 To set up <em>git daemon</em> as a regular, non-inetd service that
700 handles repositories for multiple virtual hosts based on
701 their IP addresses, start the daemon like this:
702 </p>
703 <div class="listingblock">
704 <div class="content">
705 <pre><tt> git daemon --verbose --export-all
706 --interpolated-path=/pub/%IP/%D
707 /pub/192.168.1.200/software
708 /pub/10.10.220.23/software</tt></pre>
709 </div></div>
710 <div class="para"><p>In this example, the root-level directory <tt>/pub</tt> will contain
711 a subdirectory for each virtual host IP address supported.
712 Repositories can still be accessed by hostname though, assuming
713 they correspond to these IP addresses.</p></div>
714 </dd>
715 <dt>
716 selectively enable/disable services per repository
717 </dt>
718 <dd>
720 To enable <em>git archive --remote</em> and disable <em>git fetch</em> against
721 a repository, have the following in the configuration file in the
722 repository (that is the file <em>config</em> next to <em>HEAD</em>, <em>refs</em> and
723 <em>objects</em>).
724 </p>
725 <div class="listingblock">
726 <div class="content">
727 <pre><tt> [daemon]
728 uploadpack = false
729 uploadarch = true</tt></pre>
730 </div></div>
731 </dd>
732 </dl></div>
733 </div>
734 <h2 id="_environment">ENVIRONMENT</h2>
735 <div class="sectionbody">
736 <div class="para"><p><em>git daemon</em> will set REMOTE_ADDR to the IP address of the client
737 that connected to it, if the IP address is available. REMOTE_ADDR will
738 be available in the environment of hooks called when
739 services are performed.</p></div>
740 </div>
741 <h2 id="_author">Author</h2>
742 <div class="sectionbody">
743 <div class="para"><p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;, YOSHIFUJI Hideaki
744 &lt;yoshfuji@linux-ipv6.org&gt; and the git-list &lt;git@vger.kernel.org&gt;</p></div>
745 </div>
746 <h2 id="_documentation">Documentation</h2>
747 <div class="sectionbody">
748 <div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
749 </div>
750 <h2 id="_git">GIT</h2>
751 <div class="sectionbody">
752 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
753 </div>
754 <div id="footer">
755 <div id="footer-text">
756 Last updated 2010-04-24 02:55:52 UTC
757 </div>
758 </div>
759 </body>
760 </html>