blob: 0e983efbc79ad1f8c99fa337bf99d2eac62fe04b [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!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" />
Junio C Hamano70fafca2006-02-06 08:02:016<meta name="generator" content="AsciiDoc 7.0.2" />
Junio C Hamano1a4e8412005-12-27 08:17:237<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 { color: blue; }
20a:visited { color: fuchsia; }
21
22em {
23 font-style: italic;
24}
25
26strong {
27 font-weight: bold;
28}
29
30tt {
31 color: navy;
32}
33
34h1, h2, h3, h4, h5, h6 {
35 color: #527bbd;
36 font-family: sans-serif;
37 margin-top: 1.2em;
38 margin-bottom: 0.5em;
39 line-height: 1.3;
40}
41
42h1 {
43 border-bottom: 2px solid silver;
44}
45h2 {
46 border-bottom: 2px solid silver;
47 padding-top: 0.5em;
48}
49
50div.sectionbody {
51 font-family: serif;
52 margin-left: 0;
53}
54
55hr {
56 border: 1px solid silver;
57}
58
59p {
60 margin-top: 0.5em;
61 margin-bottom: 0.5em;
62}
63
64pre {
65 padding: 0;
66 margin: 0;
67}
68
69span#author {
70 color: #527bbd;
71 font-family: sans-serif;
72 font-weight: bold;
73 font-size: 1.2em;
74}
75span#email {
76}
77span#revision {
78 font-family: sans-serif;
79}
80
81div#footer {
82 font-family: sans-serif;
83 font-size: small;
84 border-top: 2px solid silver;
85 padding-top: 0.5em;
86 margin-top: 4.0em;
87}
88div#footer-text {
89 float: left;
90 padding-bottom: 0.5em;
91}
92div#footer-badges {
93 float: right;
94 padding-bottom: 0.5em;
95}
96
97div#preamble,
98div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
99div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
100div.admonitionblock {
101 margin-right: 10%;
102 margin-top: 1.5em;
103 margin-bottom: 1.5em;
104}
105div.admonitionblock {
106 margin-top: 2.5em;
107 margin-bottom: 2.5em;
108}
109
110div.content { /* Block element content. */
111 padding: 0;
112}
113
114/* Block element titles. */
115div.title, caption.title {
116 font-family: sans-serif;
117 font-weight: bold;
118 text-align: left;
119 margin-top: 1.0em;
120 margin-bottom: 0.5em;
121}
122div.title + * {
123 margin-top: 0;
124}
125
126td div.title:first-child {
127 margin-top: 0.0em;
128}
129div.content div.title:first-child {
130 margin-top: 0.0em;
131}
132div.content + div.title {
133 margin-top: 0.0em;
134}
135
136div.sidebarblock > div.content {
137 background: #ffffee;
138 border: 1px solid silver;
139 padding: 0.5em;
140}
141
142div.listingblock > div.content {
143 border: 1px solid silver;
144 background: #f4f4f4;
145 padding: 0.5em;
146}
147
148div.quoteblock > div.content {
149 padding-left: 2.0em;
150}
151div.quoteblock .attribution {
152 text-align: right;
153}
154
155div.admonitionblock .icon {
156 vertical-align: top;
157 font-size: 1.1em;
158 font-weight: bold;
159 text-decoration: underline;
160 color: #527bbd;
161 padding-right: 0.5em;
162}
163div.admonitionblock td.content {
164 padding-left: 0.5em;
165 border-left: 2px solid silver;
166}
167
168div.exampleblock > div.content {
169 border-left: 2px solid silver;
170 padding: 0.5em;
171}
172
173div.verseblock div.content {
174 white-space: pre;
175}
176
177div.imageblock div.content { padding-left: 0; }
178div.imageblock img { border: 1px solid silver; }
179span.image img { border-style: none; }
180
181dl {
182 margin-top: 0.8em;
183 margin-bottom: 0.8em;
184}
185dt {
186 margin-top: 0.5em;
187 margin-bottom: 0;
188 font-style: italic;
189}
190dd > *:first-child {
191 margin-top: 0;
192}
193
194ul, ol {
195 list-style-position: outside;
196}
197ol.olist2 {
198 list-style-type: lower-alpha;
199}
200
201div.tableblock > table {
202 border-color: #527bbd;
203 border-width: 3px;
204}
205thead {
206 font-family: sans-serif;
207 font-weight: bold;
208}
209tfoot {
210 font-weight: bold;
211}
212
213div.hlist {
214 margin-top: 0.8em;
215 margin-bottom: 0.8em;
216}
217td.hlist1 {
218 vertical-align: top;
219 font-style: italic;
220 padding-right: 0.8em;
221}
222td.hlist2 {
223 vertical-align: top;
224}
225
226@media print {
227 div#footer-badges { display: none; }
228}
229include::./stylesheets/xhtml11-manpage.css[]
230/* Workarounds for IE6's broken and incomplete CSS2. */
231
232div.sidebar-content {
233 background: #ffffee;
234 border: 1px solid silver;
235 padding: 0.5em;
236}
237div.sidebar-title, div.image-title {
238 font-family: sans-serif;
239 font-weight: bold;
240 margin-top: 0.0em;
241 margin-bottom: 0.5em;
242}
243
244div.listingblock div.content {
245 border: 1px solid silver;
246 background: #f4f4f4;
247 padding: 0.5em;
248}
249
250div.quoteblock-content {
251 padding-left: 2.0em;
252}
253
254div.exampleblock-content {
255 border-left: 2px solid silver;
256 padding-left: 0.5em;
257}
258</style>
259<title>git-daemon(1)</title>
260</head>
261<body>
262<div id="header">
263<h1>
264git-daemon(1) Manual Page
265</h1>
266<h2>NAME</h2>
267<div class="sectionbody">
268<p>git-daemon -
Junio C Hamano01078922006-03-10 00:31:47269 A really simple server for git repositories
Junio C Hamano1a4e8412005-12-27 08:17:23270</p>
271</div>
272</div>
273<h2>SYNOPSIS</h2>
274<div class="sectionbody">
Junio C Hamano235a91e2006-01-07 01:13:58275<div class="verseblock">
Junio C Hamano032c6312006-09-28 07:39:18276<div class="content"><em>git-daemon</em> [--verbose] [--syslog] [--export-all]
Junio C Hamano4d04a402006-01-09 00:53:28277 [--timeout=n] [--init-timeout=n] [--strict-paths]
Junio C Hamano70fafca2006-02-06 08:02:01278 [--base-path=path] [--user-path | --user-path=path]
Junio C Hamano47c1e3c2006-09-25 04:45:55279 [--interpolated-path=pathtemplate]
Junio C Hamano032c6312006-09-28 07:39:18280 [--reuseaddr] [--detach] [--pid-file=file]
Junio C Hamano19ed3682006-09-07 11:44:08281 [--enable=service] [--disable=service]
282 [--allow-override=service] [--forbid-override=service]
Junio C Hamano032c6312006-09-28 07:39:18283 [--inetd | [--listen=host_or_ipaddr] [--port=n] [--user=user [--group=group]]
284 [directory&#8230;]</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23285</div>
286<h2>DESCRIPTION</h2>
287<div class="sectionbody">
288<p>A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
Junio C Hamano19ed3682006-09-07 11:44:08289aka 9418. It waits for a connection asking for a service, and will serve
290that service if it is enabled.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23291<p>It verifies that the directory has the magic file "git-daemon-export-ok", and
292it will refuse to export any git directory that hasn't explicitly been marked
293for export this way (unless the <em>--export-all</em> parameter is specified). If you
294pass some directory paths as <em>git-daemon</em> arguments, you can further restrict
295the offers to a whitelist comprising of those.</p>
Junio C Hamano19ed3682006-09-07 11:44:08296<p>By default, only <tt>upload-pack</tt> service is enabled, which serves
Junio C Hamano1fbbbc12007-12-18 07:01:27297<tt>git-fetch-pack</tt> and <tt>git-ls-remote</tt> clients, which are invoked
298from <tt>git-fetch</tt>, <tt>git-pull</tt>, and <tt>git-clone</tt>.</p>
Junio C Hamano19ed3682006-09-07 11:44:08299<p>This is ideally suited for read-only updates, i.e., pulling from
300git repositories.</p>
Junio C Hamanoa053d542006-10-27 09:29:13301<p>An <tt>upload-archive</tt> also exists to serve <tt>git-archive</tt>.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23302</div>
303<h2>OPTIONS</h2>
304<div class="sectionbody">
305<dl>
306<dt>
307--strict-paths
308</dt>
309<dd>
310<p>
311 Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
312 "/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
313 git-daemon will refuse to start when this option is enabled and no
314 whitelist is specified.
315</p>
316</dd>
317<dt>
Junio C Hamano4d04a402006-01-09 00:53:28318--base-path
319</dt>
320<dd>
321<p>
322 Remap all the path requests as relative to the given path.
323 This is sort of "GIT root" - if you run git-daemon with
324 <em>--base-path=/srv/git</em> on example.com, then if you later try to pull
325 <em>git://example.com/hello.git</em>, <tt>git-daemon</tt> will interpret the path
Junio C Hamano70fafca2006-02-06 08:02:01326 as <em>/srv/git/hello.git</em>.
Junio C Hamano4d04a402006-01-09 00:53:28327</p>
328</dd>
329<dt>
Junio C Hamano0ddc94d2007-08-01 08:42:39330--base-path-relaxed
331</dt>
332<dd>
333<p>
334 If --base-path is enabled and repo lookup fails, with this option
335 <tt>git-daemon</tt> will attempt to lookup without prefixing the base path.
336 This is useful for switching to --base-path usage, while still
337 allowing the old paths.
338</p>
339</dd>
340<dt>
Junio C Hamano47c1e3c2006-09-25 04:45:55341--interpolated-path=pathtemplate
342</dt>
343<dd>
344<p>
345 To support virtual hosting, an interpolated path template can be
346 used to dynamically construct alternate paths. The template
Junio C Hamano032c6312006-09-28 07:39:18347 supports %H for the target hostname as supplied by the client but
348 converted to all lowercase, %CH for the canonical hostname,
349 %IP for the server's IP address, %P for the port number,
Junio C Hamano47c1e3c2006-09-25 04:45:55350 and %D for the absolute path of the named repository.
Junio C Hamano032c6312006-09-28 07:39:18351 After interpolation, the path is validated against the directory
352 whitelist.
Junio C Hamano47c1e3c2006-09-25 04:45:55353</p>
354</dd>
355<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23356--export-all
357</dt>
358<dd>
359<p>
360 Allow pulling from all directories that look like GIT repositories
361 (have the <em>objects</em> and <em>refs</em> subdirectories), even if they
362 do not have the <em>git-daemon-export-ok</em> file.
363</p>
364</dd>
365<dt>
366--inetd
367</dt>
368<dd>
369<p>
370 Have the server run as an inetd service. Implies --syslog.
Junio C Hamano032c6312006-09-28 07:39:18371 Incompatible with --port, --listen, --user and --group options.
Junio C Hamano1a4e8412005-12-27 08:17:23372</p>
373</dd>
374<dt>
Junio C Hamano032c6312006-09-28 07:39:18375--listen=host_or_ipaddr
Junio C Hamano1a4e8412005-12-27 08:17:23376</dt>
377<dd>
378<p>
Junio C Hamano032c6312006-09-28 07:39:18379 Listen on an a specific IP address or hostname. IP addresses can
380 be either an IPv4 address or an IPV6 address if supported. If IPv6
381 is not supported, then --listen=hostname is also not supported and
382 --listen must be given an IPv4 address.
383 Incompatible with <em>--inetd</em> option.
384</p>
385</dd>
386<dt>
387--port=n
388</dt>
389<dd>
390<p>
391 Listen on an alternative port. Incompatible with <em>--inetd</em> option.
Junio C Hamano1a4e8412005-12-27 08:17:23392</p>
393</dd>
394<dt>
395--init-timeout
396</dt>
397<dd>
398<p>
399 Timeout between the moment the connection is established and the
400 client request is received (typically a rather low value, since
401 that should be basically immediate).
402</p>
403</dd>
404<dt>
405--timeout
406</dt>
407<dd>
408<p>
409 Timeout for specific client sub-requests. This includes the time
410 it takes for the server to process the sub-request and time spent
411 waiting for next client's request.
412</p>
413</dd>
414<dt>
415--syslog
416</dt>
417<dd>
418<p>
419 Log to syslog instead of stderr. Note that this option does not imply
420 --verbose, thus by default only error conditions will be logged.
421</p>
422</dd>
423<dt>
Junio C Hamano70fafca2006-02-06 08:02:01424--user-path, --user-path=path
425</dt>
426<dd>
427<p>
428 Allow ~user notation to be used in requests. When
429 specified with no parameter, requests to
430 git://host/~alice/foo is taken as a request to access
431 <em>foo</em> repository in the home directory of user <tt>alice</tt>.
432 If <tt>--user-path=path</tt> is specified, the same request is
433 taken as a request to access <tt>path/foo</tt> repository in
434 the home directory of user <tt>alice</tt>.
435</p>
436</dd>
437<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23438--verbose
439</dt>
440<dd>
441<p>
442 Log details about the incoming connections and requested files.
443</p>
444</dd>
445<dt>
Junio C Hamanoabb53dc2006-07-28 05:14:12446--reuseaddr
447</dt>
448<dd>
449<p>
450 Use SO_REUSEADDR when binding the listening socket.
451 This allows the server to restart without waiting for
452 old connections to time out.
453</p>
454</dd>
455<dt>
456--detach
457</dt>
458<dd>
459<p>
460 Detach from the shell. Implies --syslog.
461</p>
462</dd>
463<dt>
464--pid-file=file
465</dt>
466<dd>
467<p>
Junio C Hamano21e7f9c2007-08-31 07:56:26468 Save the process id in <em>file</em>. Ignored when the daemon
469 is run under <tt>--inetd</tt>.
Junio C Hamanoabb53dc2006-07-28 05:14:12470</p>
471</dd>
472<dt>
Junio C Hamano9adfc6a2006-08-28 07:18:38473--user=user, --group=group
474</dt>
475<dd>
476<p>
477 Change daemon's uid and gid before entering the service loop.
478 When only <tt>--user</tt> is given without <tt>--group</tt>, the
479 primary group ID for the user is used. The values of
480 the option are given to <tt>getpwnam(3)</tt> and <tt>getgrnam(3)</tt>
481 and numeric IDs are not supported.
482</p>
483<p>Giving these options is an error when used with <tt>--inetd</tt>; use
484the facility of inet daemon to achieve the same before spawning
485<tt>git-daemon</tt> if needed.</p>
486</dd>
487<dt>
Junio C Hamanofa0d4cf2007-01-25 02:23:58488--enable=service, --disable=service
Junio C Hamano19ed3682006-09-07 11:44:08489</dt>
490<dd>
491<p>
492 Enable/disable the service site-wide per default. Note
493 that a service disabled site-wide can still be enabled
494 per repository if it is marked overridable and the
495 repository enables the service with an configuration
496 item.
497</p>
498</dd>
499<dt>
Junio C Hamanofa0d4cf2007-01-25 02:23:58500--allow-override=service, --forbid-override=service
Junio C Hamano19ed3682006-09-07 11:44:08501</dt>
502<dd>
503<p>
504 Allow/forbid overriding the site-wide default with per
505 repository configuration. By default, all the services
506 are overridable.
507</p>
508</dd>
509<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23510&lt;directory&gt;
511</dt>
512<dd>
513<p>
514 A directory to add to the whitelist of allowed directories. Unless
515 --strict-paths is specified this will also include subdirectories
516 of each named directory.
517</p>
518</dd>
519</dl>
520</div>
Junio C Hamano19ed3682006-09-07 11:44:08521<h2>SERVICES</h2>
522<div class="sectionbody">
Junio C Hamano21e7f9c2007-08-31 07:56:26523<p>These services can be globally enabled/disabled using the
524command line options of this command. If a finer-grained
525control is desired (e.g. to allow <tt>git-archive</tt> to be run
526against only in a few selected repositories the daemon serves),
527the per-repository configuration file can be used to enable or
528disable them.</p>
Junio C Hamano19ed3682006-09-07 11:44:08529<dl>
530<dt>
531upload-pack
532</dt>
533<dd>
534<p>
Junio C Hamano1fbbbc12007-12-18 07:01:27535 This serves <tt>git-fetch-pack</tt> and <tt>git-ls-remote</tt>
Junio C Hamano19ed3682006-09-07 11:44:08536 clients. It is enabled by default, but a repository can
537 disable it by setting <tt>daemon.uploadpack</tt> configuration
538 item to <tt>false</tt>.
539</p>
540</dd>
Junio C Hamanoa053d542006-10-27 09:29:13541<dt>
542upload-archive
543</dt>
544<dd>
545<p>
Junio C Hamano21e7f9c2007-08-31 07:56:26546 This serves <tt>git-archive --remote</tt>. It is disabled by
547 default, but a repository can enable it by setting
548 <tt>daemon.uploadarchive</tt> configuration item to <tt>true</tt>.
549</p>
550</dd>
551<dt>
552receive-pack
553</dt>
554<dd>
555<p>
556 This serves <tt>git-send-pack</tt> clients, allowing anonymous
557 push. It is disabled by default, as there is _no_
558 authentication in the protocol (in other words, anybody
559 can push anything into the repository, including removal
560 of refs). This is solely meant for a closed LAN setting
561 where everybody is friendly. This service can be
562 enabled by <tt>daemon.receivepack</tt> configuration item to
563 <tt>true</tt>.
Junio C Hamanoa053d542006-10-27 09:29:13564</p>
565</dd>
Junio C Hamano19ed3682006-09-07 11:44:08566</dl>
567</div>
Junio C Hamano47c1e3c2006-09-25 04:45:55568<h2>EXAMPLES</h2>
569<div class="sectionbody">
570<dl>
571<dt>
Junio C Hamanoa053d542006-10-27 09:29:13572We assume the following in /etc/services
573</dt>
574<dd>
575<div class="listingblock">
576<div class="content">
577<pre><tt>$ grep 9418 /etc/services
578git 9418/tcp # Git Version Control System</tt></pre>
579</div></div>
580</dd>
581<dt>
Junio C Hamano47c1e3c2006-09-25 04:45:55582git-daemon as inetd server
583</dt>
584<dd>
585<p>
586 To set up <tt>git-daemon</tt> as an inetd service that handles any
587 repository under the whitelisted set of directories, /pub/foo
588 and /pub/bar, place an entry like the following into
589 /etc/inetd all on one line:
590</p>
591<div class="listingblock">
592<div class="content">
593<pre><tt> git stream tcp nowait nobody /usr/bin/git-daemon
Junio C Hamano29f14312006-10-26 08:47:29594 git-daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55595 /pub/foo /pub/bar</tt></pre>
596</div></div>
597</dd>
598<dt>
599git-daemon as inetd server for virtual hosts
600</dt>
601<dd>
602<p>
603 To set up <tt>git-daemon</tt> as an inetd service that handles
604 repositories for different virtual hosts, <tt>www.example.com</tt>
605 and <tt>www.example.org</tt>, place an entry like the following into
606 <tt>/etc/inetd</tt> all on one line:
607</p>
608<div class="listingblock">
609<div class="content">
610<pre><tt> git stream tcp nowait nobody /usr/bin/git-daemon
Junio C Hamano29f14312006-10-26 08:47:29611 git-daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55612 --interpolated-path=/pub/%H%D
613 /pub/www.example.org/software
614 /pub/www.example.com/software
615 /software</tt></pre>
616</div></div>
617<p>In this example, the root-level directory <tt>/pub</tt> will contain
618a subdirectory for each virtual host name supported.
619Further, both hosts advertise repositories simply as
620<tt>git://www.example.com/software/repo.git</tt>. For pre-1.4.0
621clients, a symlink from <tt>/software</tt> into the appropriate
622default repository could be made as well.</p>
623</dd>
Junio C Hamano032c6312006-09-28 07:39:18624<dt>
625git-daemon as regular daemon for virtual hosts
626</dt>
627<dd>
628<p>
629 To set up <tt>git-daemon</tt> as a regular, non-inetd service that
630 handles repositories for multiple virtual hosts based on
631 their IP addresses, start the daemon like this:
632</p>
633<div class="listingblock">
634<div class="content">
635<pre><tt> git-daemon --verbose --export-all
636 --interpolated-path=/pub/%IP/%D
637 /pub/192.168.1.200/software
638 /pub/10.10.220.23/software</tt></pre>
639</div></div>
640<p>In this example, the root-level directory <tt>/pub</tt> will contain
641a subdirectory for each virtual host IP address supported.
642Repositories can still be accessed by hostname though, assuming
643they correspond to these IP addresses.</p>
644</dd>
Junio C Hamanodbb64592007-09-01 11:17:39645<dt>
646selectively enable/disable services per repository
647</dt>
648<dd>
649<p>
650 To enable <tt>git-archive --remote</tt> and disable <tt>git-fetch</tt> against
651 a repository, have the following in the configuration file in the
652 repository (that is the file <em>config</em> next to <em>HEAD</em>, <em>refs</em> and
653 <em>objects</em>).
654</p>
Junio C Hamano21e7f9c2007-08-31 07:56:26655<div class="listingblock">
656<div class="content">
Junio C Hamanodbb64592007-09-01 11:17:39657<pre><tt> [daemon]
658 uploadpack = false
659 uploadarchive = true</tt></pre>
Junio C Hamano21e7f9c2007-08-31 07:56:26660</div></div>
Junio C Hamanodbb64592007-09-01 11:17:39661</dd>
662</dl>
Junio C Hamano47c1e3c2006-09-25 04:45:55663</div>
Junio C Hamano1a4e8412005-12-27 08:17:23664<h2>Author</h2>
665<div class="sectionbody">
666<p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;, YOSHIFUJI Hideaki
667&lt;yoshfuji@linux-ipv6.org&gt; and the git-list &lt;git@vger.kernel.org&gt;</p>
668</div>
669<h2>Documentation</h2>
670<div class="sectionbody">
671<p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p>
672</div>
673<h2>GIT</h2>
674<div class="sectionbody">
675<p>Part of the <a href="git.html">git(7)</a> suite</p>
676</div>
677<div id="footer">
678<div id="footer-text">
Junio C Hamano35738e82008-01-07 07:55:46679Last updated 07-Jan-2008 07:50:11 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23680</div>
681</div>
682</body>
683</html>