blob: 69a1e4af9ec007a6cc59cce07298a6a825369ef1 [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 Hamano1a4e8412005-12-27 08:17:23164<directory>::
165A directory to add to the whitelist of allowed directories. Unless
166--strict-paths is specified this will also include subdirectories
167of each named directory.
168
Junio C Hamano19ed3682006-09-07 11:44:08169SERVICES
170--------
171
Junio C Hamano21e7f9c2007-08-31 07:56:26172These services can be globally enabled/disabled using the
173command line options of this command. If a finer-grained
Junio C Hamano1aa40d22010-01-21 17:46:43174control is desired (e.g. to allow 'git archive' to be run
Junio C Hamano21e7f9c2007-08-31 07:56:26175against only in a few selected repositories the daemon serves),
176the per-repository configuration file can be used to enable or
177disable them.
178
Junio C Hamano19ed3682006-09-07 11:44:08179upload-pack::
Junio C Hamano1aa40d22010-01-21 17:46:43180This serves 'git fetch-pack' and 'git ls-remote'
Junio C Hamano19ed3682006-09-07 11:44:08181clients. It is enabled by default, but a repository can
182disable it by setting `daemon.uploadpack` configuration
183item to `false`.
184
Junio C Hamanoa053d542006-10-27 09:29:13185upload-archive::
Junio C Hamano1aa40d22010-01-21 17:46:43186This serves 'git archive --remote'. It is disabled by
Junio C Hamano21e7f9c2007-08-31 07:56:26187default, but a repository can enable it by setting
Junio C Hamanofeeb1be2008-05-22 00:53:35188`daemon.uploadarch` configuration item to `true`.
Junio C Hamano21e7f9c2007-08-31 07:56:26189
190receive-pack::
Junio C Hamano1aa40d22010-01-21 17:46:43191This serves 'git send-pack' clients, allowing anonymous
Junio C Hamano21e7f9c2007-08-31 07:56:26192push. It is disabled by default, as there is _no_
193authentication in the protocol (in other words, anybody
194can push anything into the repository, including removal
195of refs). This is solely meant for a closed LAN setting
196where everybody is friendly. This service can be
197enabled by `daemon.receivepack` configuration item to
198`true`.
Junio C Hamanoa053d542006-10-27 09:29:13199
Junio C Hamano47c1e3c2006-09-25 04:45:55200EXAMPLES
201--------
Junio C Hamanoa053d542006-10-27 09:29:13202We assume the following in /etc/services::
203+
204------------
205$ grep 9418 /etc/services
206git 9418/tcp # Git Version Control System
207------------
208
Junio C Hamano1aa40d22010-01-21 17:46:43209'git daemon' as inetd server::
210To set up 'git daemon' as an inetd service that handles any
Junio C Hamano47c1e3c2006-09-25 04:45:55211repository under the whitelisted set of directories, /pub/foo
212and /pub/bar, place an entry like the following into
213/etc/inetd all on one line:
214+
215------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38216git stream tcp nowait nobody /usr/bin/git
217git daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55218/pub/foo /pub/bar
219------------------------------------------------
220
221
Junio C Hamano1aa40d22010-01-21 17:46:43222'git daemon' as inetd server for virtual hosts::
223To set up 'git daemon' as an inetd service that handles
Junio C Hamano47c1e3c2006-09-25 04:45:55224repositories for different virtual hosts, `www.example.com`
225and `www.example.org`, place an entry like the following into
226`/etc/inetd` all on one line:
227+
228------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38229git stream tcp nowait nobody /usr/bin/git
230git daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55231--interpolated-path=/pub/%H%D
232/pub/www.example.org/software
233/pub/www.example.com/software
234/software
235------------------------------------------------
236+
237In this example, the root-level directory `/pub` will contain
238a subdirectory for each virtual host name supported.
239Further, both hosts advertise repositories simply as
240`git://www.example.com/software/repo.git`. For pre-1.4.0
241clients, a symlink from `/software` into the appropriate
242default repository could be made as well.
243
244
Junio C Hamano1aa40d22010-01-21 17:46:43245'git daemon' as regular daemon for virtual hosts::
246To set up 'git daemon' as a regular, non-inetd service that
Junio C Hamano032c6312006-09-28 07:39:18247handles repositories for multiple virtual hosts based on
248their IP addresses, start the daemon like this:
249+
250------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38251git daemon --verbose --export-all
Junio C Hamano032c6312006-09-28 07:39:18252--interpolated-path=/pub/%IP/%D
253/pub/192.168.1.200/software
254/pub/10.10.220.23/software
255------------------------------------------------
256+
257In this example, the root-level directory `/pub` will contain
258a subdirectory for each virtual host IP address supported.
259Repositories can still be accessed by hostname though, assuming
260they correspond to these IP addresses.
261
Junio C Hamanodbb64592007-09-01 11:17:39262selectively enable/disable services per repository::
Junio C Hamano1aa40d22010-01-21 17:46:43263To enable 'git archive --remote' and disable 'git fetch' against
Junio C Hamanodbb64592007-09-01 11:17:39264a repository, have the following in the configuration file in the
265repository (that is the file 'config' next to 'HEAD', 'refs' and
266'objects').
Junio C Hamano21e7f9c2007-08-31 07:56:26267+
268----------------------------------------------------------------
Junio C Hamanodbb64592007-09-01 11:17:39269[daemon]
270uploadpack = false
Junio C Hamanofeeb1be2008-05-22 00:53:35271uploadarch = true
Junio C Hamano21e7f9c2007-08-31 07:56:26272----------------------------------------------------------------
273
274
Junio C Hamano61b12292008-10-27 02:59:10275ENVIRONMENT
276-----------
Junio C Hamano1aa40d22010-01-21 17:46:43277'git daemon' will set REMOTE_ADDR to the IP address of the client
Junio C Hamano61b12292008-10-27 02:59:10278that connected to it, if the IP address is available. REMOTE_ADDR will
279be available in the environment of hooks called when
280services are performed.
281
Junio C Hamano1a4e8412005-12-27 08:17:23282GIT
283---
Junio C Hamanof7c042d2008-06-06 22:50:53284Part of the linkgit:git[1] suite