blob: 31b28fc29fc6e01e8505f2179b08082cf734377c [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-daemon(1)
2=============
3
4NAME
5----
Junio C Hamano01078922006-03-10 00:31:476git-daemon - A really simple server for git repositories
Junio C Hamano1a4e8412005-12-27 08:17:237
8SYNOPSIS
9--------
Junio C Hamano235a91e2006-01-07 01:13:5810[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3811'git daemon' [--verbose] [--syslog] [--export-all]
Junio C Hamanod2179ef2010-10-22 04:12:1712 [--timeout=<n>] [--init-timeout=<n>] [--max-connections=<n>]
13 [--strict-paths] [--base-path=<path>] [--base-path-relaxed]
14 [--user-path | --user-path=<path>]
15 [--interpolated-path=<pathtemplate>]
16 [--reuseaddr] [--detach] [--pid-file=<file>]
17 [--enable=<service>] [--disable=<service>]
18 [--allow-override=<service>] [--forbid-override=<service>]
19 [--inetd | [--listen=<host_or_ipaddr>] [--port=<n>] [--user=<user> [--group=<group>]]
20 [<directory>...]
Junio C Hamano1a4e8412005-12-27 08:17:2321
22DESCRIPTION
23-----------
24A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
Junio C Hamano19ed3682006-09-07 11:44:0825aka 9418. It waits for a connection asking for a service, and will serve
26that service if it is enabled.
Junio C Hamano1a4e8412005-12-27 08:17:2327
28It verifies that the directory has the magic file "git-daemon-export-ok", and
29it will refuse to export any git directory that hasn't explicitly been marked
30for export this way (unless the '--export-all' parameter is specified). If you
Junio C Hamano1aa40d22010-01-21 17:46:4331pass some directory paths as 'git daemon' arguments, you can further restrict
Junio C Hamano1a4e8412005-12-27 08:17:2332the offers to a whitelist comprising of those.
33
Junio C Hamano19ed3682006-09-07 11:44:0834By default, only `upload-pack` service is enabled, which serves
Junio C Hamano1aa40d22010-01-21 17:46:4335'git fetch-pack' and 'git ls-remote' clients, which are invoked
36from 'git fetch', 'git pull', and 'git clone'.
Junio C Hamano19ed3682006-09-07 11:44:0837
38This is ideally suited for read-only updates, i.e., pulling from
39git repositories.
Junio C Hamano1a4e8412005-12-27 08:17:2340
Junio C Hamano1aa40d22010-01-21 17:46:4341An `upload-archive` also exists to serve 'git archive'.
Junio C Hamanoa053d542006-10-27 09:29:1342
Junio C Hamano1a4e8412005-12-27 08:17:2343OPTIONS
44-------
45--strict-paths::
46Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
47"/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
Junio C Hamano1aa40d22010-01-21 17:46:4348'git daemon' will refuse to start when this option is enabled and no
Junio C Hamano1a4e8412005-12-27 08:17:2349whitelist is specified.
50
Junio C Hamanod2179ef2010-10-22 04:12:1751--base-path=<path>::
Junio C Hamano4d04a402006-01-09 00:53:2852Remap all the path requests as relative to the given path.
Junio C Hamano1aa40d22010-01-21 17:46:4353This is sort of "GIT root" - if you run 'git daemon' with
Junio C Hamano4d04a402006-01-09 00:53:2854'--base-path=/srv/git' on example.com, then if you later try to pull
Junio C Hamano1aa40d22010-01-21 17:46:4355'git://example.com/hello.git', 'git daemon' will interpret the path
Junio C Hamano70fafca2006-02-06 08:02:0156as '/srv/git/hello.git'.
Junio C Hamano4d04a402006-01-09 00:53:2857
Junio C Hamano0ddc94d2007-08-01 08:42:3958--base-path-relaxed::
59If --base-path is enabled and repo lookup fails, with this option
Junio C Hamano1aa40d22010-01-21 17:46:4360'git daemon' will attempt to lookup without prefixing the base path.
Junio C Hamano0ddc94d2007-08-01 08:42:3961This is useful for switching to --base-path usage, while still
62allowing the old paths.
63
Junio C Hamanod2179ef2010-10-22 04:12:1764--interpolated-path=<pathtemplate>::
Junio C Hamano47c1e3c2006-09-25 04:45:5565To support virtual hosting, an interpolated path template can be
66used to dynamically construct alternate paths. The template
Junio C Hamano032c6312006-09-28 07:39:1867supports %H for the target hostname as supplied by the client but
68converted to all lowercase, %CH for the canonical hostname,
69%IP for the server's IP address, %P for the port number,
Junio C Hamano47c1e3c2006-09-25 04:45:5570and %D for the absolute path of the named repository.
Junio C Hamano032c6312006-09-28 07:39:1871After interpolation, the path is validated against the directory
72whitelist.
Junio C Hamano47c1e3c2006-09-25 04:45:5573
Junio C Hamano1a4e8412005-12-27 08:17:2374--export-all::
75Allow pulling from all directories that look like GIT repositories
76(have the 'objects' and 'refs' subdirectories), even if they
77do not have the 'git-daemon-export-ok' file.
78
79--inetd::
80Have the server run as an inetd service. Implies --syslog.
Junio C Hamano97bcb482010-11-25 03:16:0781Incompatible with --detach, --port, --listen, --user and --group
82options.
Junio C Hamano1a4e8412005-12-27 08:17:2383
Junio C Hamanod2179ef2010-10-22 04:12:1784--listen=<host_or_ipaddr>::
Junio C Hamano4cfa5362009-04-18 23:01:0185Listen on a specific IP address or hostname. IP addresses can
86be either an IPv4 address or an IPv6 address if supported. If IPv6
Junio C Hamano032c6312006-09-28 07:39:1887is not supported, then --listen=hostname is also not supported and
88--listen must be given an IPv4 address.
Junio C Hamano39c7a692010-10-27 06:08:5489Can be given more than once.
Junio C Hamano032c6312006-09-28 07:39:1890Incompatible with '--inetd' option.
91
Junio C Hamanod2179ef2010-10-22 04:12:1792--port=<n>::
Junio C Hamano032c6312006-09-28 07:39:1893Listen on an alternative port. Incompatible with '--inetd' option.
Junio C Hamano1a4e8412005-12-27 08:17:2394
Junio C Hamanod2179ef2010-10-22 04:12:1795--init-timeout=<n>::
Junio C Hamano7bd050f2011-09-22 06:32:2296Timeout (in seconds) between the moment the connection is established
97and the client request is received (typically a rather low value, since
Junio C Hamano1a4e8412005-12-27 08:17:2398that should be basically immediate).
99
Junio C Hamanod2179ef2010-10-22 04:12:17100--timeout=<n>::
Junio C Hamano7bd050f2011-09-22 06:32:22101Timeout (in seconds) for specific client sub-requests. This includes
102the time it takes for the server to process the sub-request and the
103time spent waiting for the next client's request.
Junio C Hamano1a4e8412005-12-27 08:17:23104
Junio C Hamanod2179ef2010-10-22 04:12:17105--max-connections=<n>::
Junio C Hamanofcb740a2008-08-31 06:32:05106Maximum number of concurrent clients, defaults to 32. Set it to
107zero for no limit.
108
Junio C Hamano1a4e8412005-12-27 08:17:23109--syslog::
110Log to syslog instead of stderr. Note that this option does not imply
111--verbose, thus by default only error conditions will be logged.
112
Junio C Hamanoeb415992008-06-08 22:49:47113--user-path::
Junio C Hamanod2179ef2010-10-22 04:12:17114--user-path=<path>::
Junio C Hamano116db352008-12-17 19:48:40115Allow {tilde}user notation to be used in requests. When
Junio C Hamano70fafca2006-02-06 08:02:01116specified with no parameter, requests to
Junio C Hamano116db352008-12-17 19:48:40117git://host/{tilde}alice/foo is taken as a request to access
Junio C Hamano70fafca2006-02-06 08:02:01118'foo' repository in the home directory of user `alice`.
119If `--user-path=path` is specified, the same request is
120taken as a request to access `path/foo` repository in
121the home directory of user `alice`.
122
Junio C Hamano1a4e8412005-12-27 08:17:23123--verbose::
124Log details about the incoming connections and requested files.
125
Junio C Hamanoabb53dc2006-07-28 05:14:12126--reuseaddr::
127Use SO_REUSEADDR when binding the listening socket.
128This allows the server to restart without waiting for
129old connections to time out.
130
131--detach::
132Detach from the shell. Implies --syslog.
133
Junio C Hamanod2179ef2010-10-22 04:12:17134--pid-file=<file>::
Junio C Hamano21e7f9c2007-08-31 07:56:26135Save the process id in 'file'. Ignored when the daemon
136is run under `--inetd`.
Junio C Hamanoabb53dc2006-07-28 05:14:12137
Junio C Hamanod2179ef2010-10-22 04:12:17138--user=<user>::
139--group=<group>::
Junio C Hamano9adfc6a2006-08-28 07:18:38140Change daemon's uid and gid before entering the service loop.
141When only `--user` is given without `--group`, the
142primary group ID for the user is used. The values of
143the option are given to `getpwnam(3)` and `getgrnam(3)`
144and numeric IDs are not supported.
145+
146Giving these options is an error when used with `--inetd`; use
147the facility of inet daemon to achieve the same before spawning
Junio C Hamano1aa40d22010-01-21 17:46:43148'git daemon' if needed.
Junio C Hamano9adfc6a2006-08-28 07:18:38149
Junio C Hamanod2179ef2010-10-22 04:12:17150--enable=<service>::
151--disable=<service>::
Junio C Hamano19ed3682006-09-07 11:44:08152Enable/disable the service site-wide per default. Note
153that a service disabled site-wide can still be enabled
154per repository if it is marked overridable and the
Junio C Hamano4cfa5362009-04-18 23:01:01155repository enables the service with a configuration
Junio C Hamano19ed3682006-09-07 11:44:08156item.
157
Junio C Hamanod2179ef2010-10-22 04:12:17158--allow-override=<service>::
159--forbid-override=<service>::
Junio C Hamano19ed3682006-09-07 11:44:08160Allow/forbid overriding the site-wide default with per
161repository configuration. By default, all the services
162are overridable.
163
Junio C Hamano6231f822011-10-24 05:18:52164--informative-errors::
165--no-informative-errors::
166When informative errors are turned on, git-daemon will report
167more verbose errors to the client, differentiating conditions
168like "no such repository" from "repository not exported". This
169is more convenient for clients, but may leak information about
170the existence of unexported repositories. When informative
171errors are not enabled, all errors report "access denied" to the
172client. The default is --no-informative-errors.
173
Junio C Hamano1a4e8412005-12-27 08:17:23174<directory>::
175A directory to add to the whitelist of allowed directories. Unless
176--strict-paths is specified this will also include subdirectories
177of each named directory.
178
Junio C Hamano19ed3682006-09-07 11:44:08179SERVICES
180--------
181
Junio C Hamano21e7f9c2007-08-31 07:56:26182These services can be globally enabled/disabled using the
183command line options of this command. If a finer-grained
Junio C Hamano1aa40d22010-01-21 17:46:43184control is desired (e.g. to allow 'git archive' to be run
Junio C Hamano21e7f9c2007-08-31 07:56:26185against only in a few selected repositories the daemon serves),
186the per-repository configuration file can be used to enable or
187disable them.
188
Junio C Hamano19ed3682006-09-07 11:44:08189upload-pack::
Junio C Hamano1aa40d22010-01-21 17:46:43190This serves 'git fetch-pack' and 'git ls-remote'
Junio C Hamano19ed3682006-09-07 11:44:08191clients. It is enabled by default, but a repository can
192disable it by setting `daemon.uploadpack` configuration
193item to `false`.
194
Junio C Hamanoa053d542006-10-27 09:29:13195upload-archive::
Junio C Hamano1aa40d22010-01-21 17:46:43196This serves 'git archive --remote'. It is disabled by
Junio C Hamano21e7f9c2007-08-31 07:56:26197default, but a repository can enable it by setting
Junio C Hamanofeeb1be2008-05-22 00:53:35198`daemon.uploadarch` configuration item to `true`.
Junio C Hamano21e7f9c2007-08-31 07:56:26199
200receive-pack::
Junio C Hamano1aa40d22010-01-21 17:46:43201This serves 'git send-pack' clients, allowing anonymous
Junio C Hamano21e7f9c2007-08-31 07:56:26202push. It is disabled by default, as there is _no_
203authentication in the protocol (in other words, anybody
204can push anything into the repository, including removal
205of refs). This is solely meant for a closed LAN setting
206where everybody is friendly. This service can be
207enabled by `daemon.receivepack` configuration item to
208`true`.
Junio C Hamanoa053d542006-10-27 09:29:13209
Junio C Hamano47c1e3c2006-09-25 04:45:55210EXAMPLES
211--------
Junio C Hamanoa053d542006-10-27 09:29:13212We assume the following in /etc/services::
213+
214------------
215$ grep 9418 /etc/services
216git 9418/tcp # Git Version Control System
217------------
218
Junio C Hamano1aa40d22010-01-21 17:46:43219'git daemon' as inetd server::
220To set up 'git daemon' as an inetd service that handles any
Junio C Hamano47c1e3c2006-09-25 04:45:55221repository under the whitelisted set of directories, /pub/foo
222and /pub/bar, place an entry like the following into
223/etc/inetd all on one line:
224+
225------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38226git stream tcp nowait nobody /usr/bin/git
227git daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55228/pub/foo /pub/bar
229------------------------------------------------
230
231
Junio C Hamano1aa40d22010-01-21 17:46:43232'git daemon' as inetd server for virtual hosts::
233To set up 'git daemon' as an inetd service that handles
Junio C Hamano47c1e3c2006-09-25 04:45:55234repositories for different virtual hosts, `www.example.com`
235and `www.example.org`, place an entry like the following into
236`/etc/inetd` all on one line:
237+
238------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38239git stream tcp nowait nobody /usr/bin/git
240git daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55241--interpolated-path=/pub/%H%D
242/pub/www.example.org/software
243/pub/www.example.com/software
244/software
245------------------------------------------------
246+
247In this example, the root-level directory `/pub` will contain
248a subdirectory for each virtual host name supported.
249Further, both hosts advertise repositories simply as
250`git://www.example.com/software/repo.git`. For pre-1.4.0
251clients, a symlink from `/software` into the appropriate
252default repository could be made as well.
253
254
Junio C Hamano1aa40d22010-01-21 17:46:43255'git daemon' as regular daemon for virtual hosts::
256To set up 'git daemon' as a regular, non-inetd service that
Junio C Hamano032c6312006-09-28 07:39:18257handles repositories for multiple virtual hosts based on
258their IP addresses, start the daemon like this:
259+
260------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38261git daemon --verbose --export-all
Junio C Hamano032c6312006-09-28 07:39:18262--interpolated-path=/pub/%IP/%D
263/pub/192.168.1.200/software
264/pub/10.10.220.23/software
265------------------------------------------------
266+
267In this example, the root-level directory `/pub` will contain
268a subdirectory for each virtual host IP address supported.
269Repositories can still be accessed by hostname though, assuming
270they correspond to these IP addresses.
271
Junio C Hamanodbb64592007-09-01 11:17:39272selectively enable/disable services per repository::
Junio C Hamano1aa40d22010-01-21 17:46:43273To enable 'git archive --remote' and disable 'git fetch' against
Junio C Hamanodbb64592007-09-01 11:17:39274a repository, have the following in the configuration file in the
275repository (that is the file 'config' next to 'HEAD', 'refs' and
276'objects').
Junio C Hamano21e7f9c2007-08-31 07:56:26277+
278----------------------------------------------------------------
Junio C Hamanodbb64592007-09-01 11:17:39279[daemon]
280uploadpack = false
Junio C Hamanofeeb1be2008-05-22 00:53:35281uploadarch = true
Junio C Hamano21e7f9c2007-08-31 07:56:26282----------------------------------------------------------------
283
284
Junio C Hamano61b12292008-10-27 02:59:10285ENVIRONMENT
286-----------
Junio C Hamano1aa40d22010-01-21 17:46:43287'git daemon' will set REMOTE_ADDR to the IP address of the client
Junio C Hamano61b12292008-10-27 02:59:10288that connected to it, if the IP address is available. REMOTE_ADDR will
289be available in the environment of hooks called when
290services are performed.
291
Junio C Hamano1a4e8412005-12-27 08:17:23292GIT
293---
Junio C Hamanof7c042d2008-06-06 22:50:53294Part of the linkgit:git[1] suite