Autogenerated HTML docs for v1.7.5-185-g0b9dee
[git/jnareb-git.git] / git-daemon.html
blobaa810eeaf8635ee83957cea4112941b49e6c2175
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.4.5" />
7 <title>git-daemon(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-daemon(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-daemon -
411 A really simple server for git repositories
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git daemon</em> [--verbose] [--syslog] [--export-all]
419 [--timeout=&lt;n&gt;] [--init-timeout=&lt;n&gt;] [--max-connections=&lt;n&gt;]
420 [--strict-paths] [--base-path=&lt;path&gt;] [--base-path-relaxed]
421 [--user-path | --user-path=&lt;path&gt;]
422 [--interpolated-path=&lt;pathtemplate&gt;]
423 [--reuseaddr] [--detach] [--pid-file=&lt;file&gt;]
424 [--enable=&lt;service&gt;] [--disable=&lt;service&gt;]
425 [--allow-override=&lt;service&gt;] [--forbid-override=&lt;service&gt;]
426 [--inetd | [--listen=&lt;host_or_ipaddr&gt;] [--port=&lt;n&gt;] [--user=&lt;user&gt; [--group=&lt;group&gt;]]
427 [&lt;directory&gt;&#8230;]</div>
428 <div class="verseblock-attribution">
429 </div></div>
430 </div>
431 <h2 id="_description">DESCRIPTION</h2>
432 <div class="sectionbody">
433 <div class="paragraph"><p>A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
434 aka 9418. It waits for a connection asking for a service, and will serve
435 that service if it is enabled.</p></div>
436 <div class="paragraph"><p>It verifies that the directory has the magic file "git-daemon-export-ok", and
437 it will refuse to export any git directory that hasn&#8217;t explicitly been marked
438 for export this way (unless the <em>--export-all</em> parameter is specified). If you
439 pass some directory paths as <em>git daemon</em> arguments, you can further restrict
440 the offers to a whitelist comprising of those.</p></div>
441 <div class="paragraph"><p>By default, only <tt>upload-pack</tt> service is enabled, which serves
442 <em>git fetch-pack</em> and <em>git ls-remote</em> clients, which are invoked
443 from <em>git fetch</em>, <em>git pull</em>, and <em>git clone</em>.</p></div>
444 <div class="paragraph"><p>This is ideally suited for read-only updates, i.e., pulling from
445 git repositories.</p></div>
446 <div class="paragraph"><p>An <tt>upload-archive</tt> also exists to serve <em>git archive</em>.</p></div>
447 </div>
448 <h2 id="_options">OPTIONS</h2>
449 <div class="sectionbody">
450 <div class="dlist"><dl>
451 <dt class="hdlist1">
452 --strict-paths
453 </dt>
454 <dd>
456 Match paths exactly (i.e. don&#8217;t allow "/foo/repo" when the real path is
457 "/foo/repo.git" or "/foo/repo/.git") and don&#8217;t do user-relative paths.
458 <em>git daemon</em> will refuse to start when this option is enabled and no
459 whitelist is specified.
460 </p>
461 </dd>
462 <dt class="hdlist1">
463 --base-path=&lt;path&gt;
464 </dt>
465 <dd>
467 Remap all the path requests as relative to the given path.
468 This is sort of "GIT root" - if you run <em>git daemon</em> with
469 <em>--base-path=/srv/git</em> on example.com, then if you later try to pull
470 <em>git://example.com/hello.git</em>, <em>git daemon</em> will interpret the path
471 as <em>/srv/git/hello.git</em>.
472 </p>
473 </dd>
474 <dt class="hdlist1">
475 --base-path-relaxed
476 </dt>
477 <dd>
479 If --base-path is enabled and repo lookup fails, with this option
480 <em>git daemon</em> will attempt to lookup without prefixing the base path.
481 This is useful for switching to --base-path usage, while still
482 allowing the old paths.
483 </p>
484 </dd>
485 <dt class="hdlist1">
486 --interpolated-path=&lt;pathtemplate&gt;
487 </dt>
488 <dd>
490 To support virtual hosting, an interpolated path template can be
491 used to dynamically construct alternate paths. The template
492 supports %H for the target hostname as supplied by the client but
493 converted to all lowercase, %CH for the canonical hostname,
494 %IP for the server&#8217;s IP address, %P for the port number,
495 and %D for the absolute path of the named repository.
496 After interpolation, the path is validated against the directory
497 whitelist.
498 </p>
499 </dd>
500 <dt class="hdlist1">
501 --export-all
502 </dt>
503 <dd>
505 Allow pulling from all directories that look like GIT repositories
506 (have the <em>objects</em> and <em>refs</em> subdirectories), even if they
507 do not have the <em>git-daemon-export-ok</em> file.
508 </p>
509 </dd>
510 <dt class="hdlist1">
511 --inetd
512 </dt>
513 <dd>
515 Have the server run as an inetd service. Implies --syslog.
516 Incompatible with --detach, --port, --listen, --user and --group
517 options.
518 </p>
519 </dd>
520 <dt class="hdlist1">
521 --listen=&lt;host_or_ipaddr&gt;
522 </dt>
523 <dd>
525 Listen on a specific IP address or hostname. IP addresses can
526 be either an IPv4 address or an IPv6 address if supported. If IPv6
527 is not supported, then --listen=hostname is also not supported and
528 --listen must be given an IPv4 address.
529 Can be given more than once.
530 Incompatible with <em>--inetd</em> option.
531 </p>
532 </dd>
533 <dt class="hdlist1">
534 --port=&lt;n&gt;
535 </dt>
536 <dd>
538 Listen on an alternative port. Incompatible with <em>--inetd</em> option.
539 </p>
540 </dd>
541 <dt class="hdlist1">
542 --init-timeout=&lt;n&gt;
543 </dt>
544 <dd>
546 Timeout between the moment the connection is established and the
547 client request is received (typically a rather low value, since
548 that should be basically immediate).
549 </p>
550 </dd>
551 <dt class="hdlist1">
552 --timeout=&lt;n&gt;
553 </dt>
554 <dd>
556 Timeout for specific client sub-requests. This includes the time
557 it takes for the server to process the sub-request and the time spent
558 waiting for the next client&#8217;s request.
559 </p>
560 </dd>
561 <dt class="hdlist1">
562 --max-connections=&lt;n&gt;
563 </dt>
564 <dd>
566 Maximum number of concurrent clients, defaults to 32. Set it to
567 zero for no limit.
568 </p>
569 </dd>
570 <dt class="hdlist1">
571 --syslog
572 </dt>
573 <dd>
575 Log to syslog instead of stderr. Note that this option does not imply
576 --verbose, thus by default only error conditions will be logged.
577 </p>
578 </dd>
579 <dt class="hdlist1">
580 --user-path
581 </dt>
582 <dt class="hdlist1">
583 --user-path=&lt;path&gt;
584 </dt>
585 <dd>
587 Allow &#126;user notation to be used in requests. When
588 specified with no parameter, requests to
589 git://host/&#126;alice/foo is taken as a request to access
590 <em>foo</em> repository in the home directory of user <tt>alice</tt>.
591 If <tt>--user-path=path</tt> is specified, the same request is
592 taken as a request to access <tt>path/foo</tt> repository in
593 the home directory of user <tt>alice</tt>.
594 </p>
595 </dd>
596 <dt class="hdlist1">
597 --verbose
598 </dt>
599 <dd>
601 Log details about the incoming connections and requested files.
602 </p>
603 </dd>
604 <dt class="hdlist1">
605 --reuseaddr
606 </dt>
607 <dd>
609 Use SO_REUSEADDR when binding the listening socket.
610 This allows the server to restart without waiting for
611 old connections to time out.
612 </p>
613 </dd>
614 <dt class="hdlist1">
615 --detach
616 </dt>
617 <dd>
619 Detach from the shell. Implies --syslog.
620 </p>
621 </dd>
622 <dt class="hdlist1">
623 --pid-file=&lt;file&gt;
624 </dt>
625 <dd>
627 Save the process id in <em>file</em>. Ignored when the daemon
628 is run under <tt>--inetd</tt>.
629 </p>
630 </dd>
631 <dt class="hdlist1">
632 --user=&lt;user&gt;
633 </dt>
634 <dt class="hdlist1">
635 --group=&lt;group&gt;
636 </dt>
637 <dd>
639 Change daemon&#8217;s uid and gid before entering the service loop.
640 When only <tt>--user</tt> is given without <tt>--group</tt>, the
641 primary group ID for the user is used. The values of
642 the option are given to <tt>getpwnam(3)</tt> and <tt>getgrnam(3)</tt>
643 and numeric IDs are not supported.
644 </p>
645 <div class="paragraph"><p>Giving these options is an error when used with <tt>--inetd</tt>; use
646 the facility of inet daemon to achieve the same before spawning
647 <em>git daemon</em> if needed.</p></div>
648 </dd>
649 <dt class="hdlist1">
650 --enable=&lt;service&gt;
651 </dt>
652 <dt class="hdlist1">
653 --disable=&lt;service&gt;
654 </dt>
655 <dd>
657 Enable/disable the service site-wide per default. Note
658 that a service disabled site-wide can still be enabled
659 per repository if it is marked overridable and the
660 repository enables the service with a configuration
661 item.
662 </p>
663 </dd>
664 <dt class="hdlist1">
665 --allow-override=&lt;service&gt;
666 </dt>
667 <dt class="hdlist1">
668 --forbid-override=&lt;service&gt;
669 </dt>
670 <dd>
672 Allow/forbid overriding the site-wide default with per
673 repository configuration. By default, all the services
674 are overridable.
675 </p>
676 </dd>
677 <dt class="hdlist1">
678 &lt;directory&gt;
679 </dt>
680 <dd>
682 A directory to add to the whitelist of allowed directories. Unless
683 --strict-paths is specified this will also include subdirectories
684 of each named directory.
685 </p>
686 </dd>
687 </dl></div>
688 </div>
689 <h2 id="_services">SERVICES</h2>
690 <div class="sectionbody">
691 <div class="paragraph"><p>These services can be globally enabled/disabled using the
692 command line options of this command. If a finer-grained
693 control is desired (e.g. to allow <em>git archive</em> to be run
694 against only in a few selected repositories the daemon serves),
695 the per-repository configuration file can be used to enable or
696 disable them.</p></div>
697 <div class="dlist"><dl>
698 <dt class="hdlist1">
699 upload-pack
700 </dt>
701 <dd>
703 This serves <em>git fetch-pack</em> and <em>git ls-remote</em>
704 clients. It is enabled by default, but a repository can
705 disable it by setting <tt>daemon.uploadpack</tt> configuration
706 item to <tt>false</tt>.
707 </p>
708 </dd>
709 <dt class="hdlist1">
710 upload-archive
711 </dt>
712 <dd>
714 This serves <em>git archive --remote</em>. It is disabled by
715 default, but a repository can enable it by setting
716 <tt>daemon.uploadarch</tt> configuration item to <tt>true</tt>.
717 </p>
718 </dd>
719 <dt class="hdlist1">
720 receive-pack
721 </dt>
722 <dd>
724 This serves <em>git send-pack</em> clients, allowing anonymous
725 push. It is disabled by default, as there is <em>no</em>
726 authentication in the protocol (in other words, anybody
727 can push anything into the repository, including removal
728 of refs). This is solely meant for a closed LAN setting
729 where everybody is friendly. This service can be
730 enabled by <tt>daemon.receivepack</tt> configuration item to
731 <tt>true</tt>.
732 </p>
733 </dd>
734 </dl></div>
735 </div>
736 <h2 id="_examples">EXAMPLES</h2>
737 <div class="sectionbody">
738 <div class="dlist"><dl>
739 <dt class="hdlist1">
740 We assume the following in /etc/services
741 </dt>
742 <dd>
743 <div class="listingblock">
744 <div class="content">
745 <pre><tt>$ grep 9418 /etc/services
746 git 9418/tcp # Git Version Control System</tt></pre>
747 </div></div>
748 </dd>
749 <dt class="hdlist1">
750 <em>git daemon</em> as inetd server
751 </dt>
752 <dd>
754 To set up <em>git daemon</em> as an inetd service that handles any
755 repository under the whitelisted set of directories, /pub/foo
756 and /pub/bar, place an entry like the following into
757 /etc/inetd all on one line:
758 </p>
759 <div class="listingblock">
760 <div class="content">
761 <pre><tt> git stream tcp nowait nobody /usr/bin/git
762 git daemon --inetd --verbose --export-all
763 /pub/foo /pub/bar</tt></pre>
764 </div></div>
765 </dd>
766 <dt class="hdlist1">
767 <em>git daemon</em> as inetd server for virtual hosts
768 </dt>
769 <dd>
771 To set up <em>git daemon</em> as an inetd service that handles
772 repositories for different virtual hosts, <tt>www.example.com</tt>
773 and <tt>www.example.org</tt>, place an entry like the following into
774 <tt>/etc/inetd</tt> all on one line:
775 </p>
776 <div class="listingblock">
777 <div class="content">
778 <pre><tt> git stream tcp nowait nobody /usr/bin/git
779 git daemon --inetd --verbose --export-all
780 --interpolated-path=/pub/%H%D
781 /pub/www.example.org/software
782 /pub/www.example.com/software
783 /software</tt></pre>
784 </div></div>
785 <div class="paragraph"><p>In this example, the root-level directory <tt>/pub</tt> will contain
786 a subdirectory for each virtual host name supported.
787 Further, both hosts advertise repositories simply as
788 <tt>git://www.example.com/software/repo.git</tt>. For pre-1.4.0
789 clients, a symlink from <tt>/software</tt> into the appropriate
790 default repository could be made as well.</p></div>
791 </dd>
792 <dt class="hdlist1">
793 <em>git daemon</em> as regular daemon for virtual hosts
794 </dt>
795 <dd>
797 To set up <em>git daemon</em> as a regular, non-inetd service that
798 handles repositories for multiple virtual hosts based on
799 their IP addresses, start the daemon like this:
800 </p>
801 <div class="listingblock">
802 <div class="content">
803 <pre><tt> git daemon --verbose --export-all
804 --interpolated-path=/pub/%IP/%D
805 /pub/192.168.1.200/software
806 /pub/10.10.220.23/software</tt></pre>
807 </div></div>
808 <div class="paragraph"><p>In this example, the root-level directory <tt>/pub</tt> will contain
809 a subdirectory for each virtual host IP address supported.
810 Repositories can still be accessed by hostname though, assuming
811 they correspond to these IP addresses.</p></div>
812 </dd>
813 <dt class="hdlist1">
814 selectively enable/disable services per repository
815 </dt>
816 <dd>
818 To enable <em>git archive --remote</em> and disable <em>git fetch</em> against
819 a repository, have the following in the configuration file in the
820 repository (that is the file <em>config</em> next to <em>HEAD</em>, <em>refs</em> and
821 <em>objects</em>).
822 </p>
823 <div class="listingblock">
824 <div class="content">
825 <pre><tt> [daemon]
826 uploadpack = false
827 uploadarch = true</tt></pre>
828 </div></div>
829 </dd>
830 </dl></div>
831 </div>
832 <h2 id="_environment">ENVIRONMENT</h2>
833 <div class="sectionbody">
834 <div class="paragraph"><p><em>git daemon</em> will set REMOTE_ADDR to the IP address of the client
835 that connected to it, if the IP address is available. REMOTE_ADDR will
836 be available in the environment of hooks called when
837 services are performed.</p></div>
838 </div>
839 <h2 id="_git">GIT</h2>
840 <div class="sectionbody">
841 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
842 </div>
843 <div id="footer">
844 <div id="footer-text">
845 Last updated 2011-03-15 23:30:13 UTC
846 </div>
847 </div>
848 </body>
849 </html>