1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
\r
4 <article lang="en" id="git-daemon(1)">
\r
6 <title>git-daemon(1)</title>
\r
8 <primary>git-daemon(1)</primary>
\r
11 <simplesect id="_name">
\r
13 <simpara>git-daemon - A really simple server for git repositories</simpara>
\r
15 <simplesect id="_synopsis">
\r
16 <title>SYNOPSIS</title>
\r
18 <literallayout><emphasis>git daemon</emphasis> [--verbose] [--syslog] [--export-all]
\r
19 [--timeout=<n>] [--init-timeout=<n>] [--max-connections=<n>]
\r
20 [--strict-paths] [--base-path=<path>] [--base-path-relaxed]
\r
21 [--user-path | --user-path=<path>]
\r
22 [--interpolated-path=<pathtemplate>]
\r
23 [--reuseaddr] [--detach] [--pid-file=<file>]
\r
24 [--enable=<service>] [--disable=<service>]
\r
25 [--allow-override=<service>] [--forbid-override=<service>]
\r
26 [--inetd | [--listen=<host_or_ipaddr>] [--port=<n>] [--user=<user> [--group=<group>]]
\r
27 [<directory>…]</literallayout>
\r
30 <simplesect id="_description">
\r
31 <title>DESCRIPTION</title>
\r
32 <simpara>A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
\r
33 aka 9418. It waits for a connection asking for a service, and will serve
\r
34 that service if it is enabled.</simpara>
\r
35 <simpara>It verifies that the directory has the magic file "git-daemon-export-ok", and
\r
36 it will refuse to export any git directory that hasn't explicitly been marked
\r
37 for export this way (unless the <emphasis>--export-all</emphasis> parameter is specified). If you
\r
38 pass some directory paths as <emphasis>git daemon</emphasis> arguments, you can further restrict
\r
39 the offers to a whitelist comprising of those.</simpara>
\r
40 <simpara>By default, only <emphasis>upload-pack</emphasis> service is enabled, which serves
\r
41 <emphasis>git fetch-pack</emphasis> and <emphasis>git ls-remote</emphasis> clients, which are invoked
\r
42 from <emphasis>git fetch</emphasis>, <emphasis>git pull</emphasis>, and <emphasis>git clone</emphasis>.</simpara>
\r
43 <simpara>This is ideally suited for read-only updates, i.e., pulling from
\r
44 git repositories.</simpara>
\r
45 <simpara>An <emphasis>upload-archive</emphasis> also exists to serve <emphasis>git archive</emphasis>.</simpara>
\r
47 <simplesect id="_options">
\r
48 <title>OPTIONS</title>
\r
56 Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
\r
57 "/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
\r
58 <emphasis>git daemon</emphasis> will refuse to start when this option is enabled and no
\r
59 whitelist is specified.
\r
65 --base-path=<path>
\r
69 Remap all the path requests as relative to the given path.
\r
70 This is sort of "GIT root" - if you run <emphasis>git daemon</emphasis> with
\r
71 <emphasis>--base-path=/srv/git</emphasis> on example.com, then if you later try to pull
\r
72 <emphasis>git://example.com/hello.git</emphasis>, <emphasis>git daemon</emphasis> will interpret the path
\r
73 as <emphasis>/srv/git/hello.git</emphasis>.
\r
83 If --base-path is enabled and repo lookup fails, with this option
\r
84 <emphasis>git daemon</emphasis> will attempt to lookup without prefixing the base path.
\r
85 This is useful for switching to --base-path usage, while still
\r
86 allowing the old paths.
\r
92 --interpolated-path=<pathtemplate>
\r
96 To support virtual hosting, an interpolated path template can be
\r
97 used to dynamically construct alternate paths. The template
\r
98 supports %H for the target hostname as supplied by the client but
\r
99 converted to all lowercase, %CH for the canonical hostname,
\r
100 %IP for the server's IP address, %P for the port number,
\r
101 and %D for the absolute path of the named repository.
\r
102 After interpolation, the path is validated against the directory
\r
113 Allow pulling from all directories that look like GIT repositories
\r
114 (have the <emphasis>objects</emphasis> and <emphasis>refs</emphasis> subdirectories), even if they
\r
115 do not have the <emphasis>git-daemon-export-ok</emphasis> file.
\r
125 Have the server run as an inetd service. Implies --syslog.
\r
126 Incompatible with --detach, --port, --listen, --user and --group
\r
133 --listen=<host_or_ipaddr>
\r
137 Listen on a specific IP address or hostname. IP addresses can
\r
138 be either an IPv4 address or an IPv6 address if supported. If IPv6
\r
139 is not supported, then --listen=hostname is also not supported and
\r
140 --listen must be given an IPv4 address.
\r
141 Can be given more than once.
\r
142 Incompatible with <emphasis>--inetd</emphasis> option.
\r
152 Listen on an alternative port. Incompatible with <emphasis>--inetd</emphasis> option.
\r
158 --init-timeout=<n>
\r
162 Timeout (in seconds) between the moment the connection is established
\r
163 and the client request is received (typically a rather low value, since
\r
164 that should be basically immediate).
\r
170 --timeout=<n>
\r
174 Timeout (in seconds) for specific client sub-requests. This includes
\r
175 the time it takes for the server to process the sub-request and the
\r
176 time spent waiting for the next client's request.
\r
182 --max-connections=<n>
\r
186 Maximum number of concurrent clients, defaults to 32. Set it to
\r
197 Log to syslog instead of stderr. Note that this option does not imply
\r
198 --verbose, thus by default only error conditions will be logged.
\r
207 --user-path=<path>
\r
211 Allow ~user notation to be used in requests. When
\r
212 specified with no parameter, requests to
\r
213 git://host/~alice/foo is taken as a request to access
\r
214 <emphasis>foo</emphasis> repository in the home directory of user <emphasis>alice</emphasis>.
\r
215 If <emphasis>--user-path=path</emphasis> is specified, the same request is
\r
216 taken as a request to access <emphasis>path/foo</emphasis> repository in
\r
217 the home directory of user <emphasis>alice</emphasis>.
\r
227 Log details about the incoming connections and requested files.
\r
237 Use SO_REUSEADDR when binding the listening socket.
\r
238 This allows the server to restart without waiting for
\r
239 old connections to time out.
\r
249 Detach from the shell. Implies --syslog.
\r
255 --pid-file=<file>
\r
259 Save the process id in <emphasis>file</emphasis>. Ignored when the daemon
\r
260 is run under <emphasis>--inetd</emphasis>.
\r
266 --user=<user>
\r
269 --group=<group>
\r
273 Change daemon's uid and gid before entering the service loop.
\r
274 When only <emphasis>--user</emphasis> is given without <emphasis>--group</emphasis>, the
\r
275 primary group ID for the user is used. The values of
\r
276 the option are given to <emphasis>getpwnam(3)</emphasis> and <emphasis>getgrnam(3)</emphasis>
\r
277 and numeric IDs are not supported.
\r
279 <simpara>Giving these options is an error when used with <emphasis>--inetd</emphasis>; use
\r
280 the facility of inet daemon to achieve the same before spawning
\r
281 <emphasis>git daemon</emphasis> if needed.</simpara>
\r
286 --enable=<service>
\r
289 --disable=<service>
\r
293 Enable/disable the service site-wide per default. Note
\r
294 that a service disabled site-wide can still be enabled
\r
295 per repository if it is marked overridable and the
\r
296 repository enables the service with a configuration
\r
303 --allow-override=<service>
\r
306 --forbid-override=<service>
\r
310 Allow/forbid overriding the site-wide default with per
\r
311 repository configuration. By default, all the services
\r
318 --informative-errors
\r
321 --no-informative-errors
\r
325 When informative errors are turned on, git-daemon will report
\r
326 more verbose errors to the client, differentiating conditions
\r
327 like "no such repository" from "repository not exported". This
\r
328 is more convenient for clients, but may leak information about
\r
329 the existence of unexported repositories. When informative
\r
330 errors are not enabled, all errors report "access denied" to the
\r
331 client. The default is --no-informative-errors.
\r
341 A directory to add to the whitelist of allowed directories. Unless
\r
342 --strict-paths is specified this will also include subdirectories
\r
343 of each named directory.
\r
349 <simplesect id="_services">
\r
350 <title>SERVICES</title>
\r
351 <simpara>These services can be globally enabled/disabled using the
\r
352 command line options of this command. If a finer-grained
\r
353 control is desired (e.g. to allow <emphasis>git archive</emphasis> to be run
\r
354 against only in a few selected repositories the daemon serves),
\r
355 the per-repository configuration file can be used to enable or
\r
356 disable them.</simpara>
\r
364 This serves <emphasis>git fetch-pack</emphasis> and <emphasis>git ls-remote</emphasis>
\r
365 clients. It is enabled by default, but a repository can
\r
366 disable it by setting <emphasis>daemon.uploadpack</emphasis> configuration
\r
367 item to <emphasis>false</emphasis>.
\r
377 This serves <emphasis>git archive --remote</emphasis>. It is disabled by
\r
378 default, but a repository can enable it by setting
\r
379 <emphasis>daemon.uploadarch</emphasis> configuration item to <emphasis>true</emphasis>.
\r
389 This serves <emphasis>git send-pack</emphasis> clients, allowing anonymous
\r
390 push. It is disabled by default, as there is <emphasis>no</emphasis>
\r
391 authentication in the protocol (in other words, anybody
\r
392 can push anything into the repository, including removal
\r
393 of refs). This is solely meant for a closed LAN setting
\r
394 where everybody is friendly. This service can be
\r
395 enabled by <emphasis>daemon.receivepack</emphasis> configuration item to
\r
396 <emphasis>true</emphasis>.
\r
402 <simplesect id="_examples">
\r
403 <title>EXAMPLES</title>
\r
407 We assume the following in /etc/services
\r
410 <screen>$ grep 9418 /etc/services
\r
411 git 9418/tcp # Git Version Control System</screen>
\r
416 <emphasis>git daemon</emphasis> as inetd server
\r
420 To set up <emphasis>git daemon</emphasis> as an inetd service that handles any
\r
421 repository under the whitelisted set of directories, /pub/foo
\r
422 and /pub/bar, place an entry like the following into
\r
423 /etc/inetd all on one line:
\r
425 <screen> git stream tcp nowait nobody /usr/bin/git
\r
426 git daemon --inetd --verbose --export-all
\r
427 /pub/foo /pub/bar</screen>
\r
432 <emphasis>git daemon</emphasis> as inetd server for virtual hosts
\r
436 To set up <emphasis>git daemon</emphasis> as an inetd service that handles
\r
437 repositories for different virtual hosts, <emphasis>www.example.com</emphasis>
\r
438 and <emphasis>www.example.org</emphasis>, place an entry like the following into
\r
439 <emphasis>/etc/inetd</emphasis> all on one line:
\r
441 <screen> git stream tcp nowait nobody /usr/bin/git
\r
442 git daemon --inetd --verbose --export-all
\r
443 --interpolated-path=/pub/%H%D
\r
444 /pub/www.example.org/software
\r
445 /pub/www.example.com/software
\r
447 <simpara>In this example, the root-level directory <emphasis>/pub</emphasis> will contain
\r
448 a subdirectory for each virtual host name supported.
\r
449 Further, both hosts advertise repositories simply as
\r
450 <emphasis>git://www.example.com/software/repo.git</emphasis>. For pre-1.4.0
\r
451 clients, a symlink from <emphasis>/software</emphasis> into the appropriate
\r
452 default repository could be made as well.</simpara>
\r
457 <emphasis>git daemon</emphasis> as regular daemon for virtual hosts
\r
461 To set up <emphasis>git daemon</emphasis> as a regular, non-inetd service that
\r
462 handles repositories for multiple virtual hosts based on
\r
463 their IP addresses, start the daemon like this:
\r
465 <screen> git daemon --verbose --export-all
\r
466 --interpolated-path=/pub/%IP/%D
\r
467 /pub/192.168.1.200/software
\r
468 /pub/10.10.220.23/software</screen>
\r
469 <simpara>In this example, the root-level directory <emphasis>/pub</emphasis> will contain
\r
470 a subdirectory for each virtual host IP address supported.
\r
471 Repositories can still be accessed by hostname though, assuming
\r
472 they correspond to these IP addresses.</simpara>
\r
477 selectively enable/disable services per repository
\r
481 To enable <emphasis>git archive --remote</emphasis> and disable <emphasis>git fetch</emphasis> against
\r
482 a repository, have the following in the configuration file in the
\r
483 repository (that is the file <emphasis>config</emphasis> next to <emphasis>HEAD</emphasis>, <emphasis>refs</emphasis> and
\r
484 <emphasis>objects</emphasis>).
\r
488 uploadarch = true</screen>
\r
493 <simplesect id="_environment">
\r
494 <title>ENVIRONMENT</title>
\r
495 <simpara><emphasis>git daemon</emphasis> will set REMOTE_ADDR to the IP address of the client
\r
496 that connected to it, if the IP address is available. REMOTE_ADDR will
\r
497 be available in the environment of hooks called when
\r
498 services are performed.</simpara>
\r
500 <simplesect id="_git">
\r
502 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
\r