blob: 4ba4b75c1126d87c48935e7697e05f0d5210ad2d [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]
12 [--timeout=n] [--init-timeout=n] [--strict-paths]
13 [--base-path=path] [--user-path | --user-path=path]
14 [--interpolated-path=pathtemplate]
15 [--reuseaddr] [--detach] [--pid-file=file]
16 [--enable=service] [--disable=service]
Junio C Hamano19ed3682006-09-07 11:44:0817 [--allow-override=service] [--forbid-override=service]
Junio C Hamano032c6312006-09-28 07:39:1818 [--inetd | [--listen=host_or_ipaddr] [--port=n] [--user=user [--group=group]]
19 [directory...]
Junio C Hamano1a4e8412005-12-27 08:17:2320
21DESCRIPTION
22-----------
23A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
Junio C Hamano19ed3682006-09-07 11:44:0824aka 9418. It waits for a connection asking for a service, and will serve
25that service if it is enabled.
Junio C Hamano1a4e8412005-12-27 08:17:2326
27It verifies that the directory has the magic file "git-daemon-export-ok", and
28it will refuse to export any git directory that hasn't explicitly been marked
29for export this way (unless the '--export-all' parameter is specified). If you
Junio C Hamanoba4b9282008-07-06 05:20:3130pass some directory paths as 'git-daemon' arguments, you can further restrict
Junio C Hamano1a4e8412005-12-27 08:17:2331the offers to a whitelist comprising of those.
32
Junio C Hamano19ed3682006-09-07 11:44:0833By default, only `upload-pack` service is enabled, which serves
Junio C Hamanoba4b9282008-07-06 05:20:3134'git-fetch-pack' and 'git-ls-remote' clients, which are invoked
35from 'git-fetch', 'git-pull', and 'git-clone'.
Junio C Hamano19ed3682006-09-07 11:44:0836
37This is ideally suited for read-only updates, i.e., pulling from
38git repositories.
Junio C Hamano1a4e8412005-12-27 08:17:2339
Junio C Hamanoba4b9282008-07-06 05:20:3140An `upload-archive` also exists to serve 'git-archive'.
Junio C Hamanoa053d542006-10-27 09:29:1341
Junio C Hamano1a4e8412005-12-27 08:17:2342OPTIONS
43-------
44--strict-paths::
45Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
46"/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
Junio C Hamanoba4b9282008-07-06 05:20:3147'git-daemon' will refuse to start when this option is enabled and no
Junio C Hamano1a4e8412005-12-27 08:17:2348whitelist is specified.
49
Junio C Hamano4d04a402006-01-09 00:53:2850--base-path::
51Remap all the path requests as relative to the given path.
Junio C Hamanoba4b9282008-07-06 05:20:3152This is sort of "GIT root" - if you run 'git-daemon' with
Junio C Hamano4d04a402006-01-09 00:53:2853'--base-path=/srv/git' on example.com, then if you later try to pull
Junio C Hamanoba4b9282008-07-06 05:20:3154'git://example.com/hello.git', 'git-daemon' will interpret the path
Junio C Hamano70fafca2006-02-06 08:02:0155as '/srv/git/hello.git'.
Junio C Hamano4d04a402006-01-09 00:53:2856
Junio C Hamano0ddc94d2007-08-01 08:42:3957--base-path-relaxed::
58If --base-path is enabled and repo lookup fails, with this option
Junio C Hamanoba4b9282008-07-06 05:20:3159'git-daemon' will attempt to lookup without prefixing the base path.
Junio C Hamano0ddc94d2007-08-01 08:42:3960This is useful for switching to --base-path usage, while still
61allowing the old paths.
62
Junio C Hamano47c1e3c2006-09-25 04:45:5563--interpolated-path=pathtemplate::
64To support virtual hosting, an interpolated path template can be
65used to dynamically construct alternate paths. The template
Junio C Hamano032c6312006-09-28 07:39:1866supports %H for the target hostname as supplied by the client but
67converted to all lowercase, %CH for the canonical hostname,
68%IP for the server's IP address, %P for the port number,
Junio C Hamano47c1e3c2006-09-25 04:45:5569and %D for the absolute path of the named repository.
Junio C Hamano032c6312006-09-28 07:39:1870After interpolation, the path is validated against the directory
71whitelist.
Junio C Hamano47c1e3c2006-09-25 04:45:5572
Junio C Hamano1a4e8412005-12-27 08:17:2373--export-all::
74Allow pulling from all directories that look like GIT repositories
75(have the 'objects' and 'refs' subdirectories), even if they
76do not have the 'git-daemon-export-ok' file.
77
78--inetd::
79Have the server run as an inetd service. Implies --syslog.
Junio C Hamano032c6312006-09-28 07:39:1880Incompatible with --port, --listen, --user and --group options.
Junio C Hamano1a4e8412005-12-27 08:17:2381
Junio C Hamano032c6312006-09-28 07:39:1882--listen=host_or_ipaddr::
83Listen on an a specific IP address or hostname. IP addresses can
84be either an IPv4 address or an IPV6 address if supported. If IPv6
85is not supported, then --listen=hostname is also not supported and
86--listen must be given an IPv4 address.
87Incompatible with '--inetd' option.
88
89--port=n::
90Listen on an alternative port. Incompatible with '--inetd' option.
Junio C Hamano1a4e8412005-12-27 08:17:2391
92--init-timeout::
93Timeout between the moment the connection is established and the
94client request is received (typically a rather low value, since
95that should be basically immediate).
96
97--timeout::
98Timeout for specific client sub-requests. This includes the time
99it takes for the server to process the sub-request and time spent
100waiting for next client's request.
101
102--syslog::
103Log to syslog instead of stderr. Note that this option does not imply
104--verbose, thus by default only error conditions will be logged.
105
Junio C Hamanoeb415992008-06-08 22:49:47106--user-path::
107--user-path=path::
Junio C Hamano70fafca2006-02-06 08:02:01108Allow ~user notation to be used in requests. When
109specified with no parameter, requests to
110git://host/~alice/foo is taken as a request to access
111'foo' repository in the home directory of user `alice`.
112If `--user-path=path` is specified, the same request is
113taken as a request to access `path/foo` repository in
114the home directory of user `alice`.
115
Junio C Hamano1a4e8412005-12-27 08:17:23116--verbose::
117Log details about the incoming connections and requested files.
118
Junio C Hamanoabb53dc2006-07-28 05:14:12119--reuseaddr::
120Use SO_REUSEADDR when binding the listening socket.
121This allows the server to restart without waiting for
122old connections to time out.
123
124--detach::
125Detach from the shell. Implies --syslog.
126
127--pid-file=file::
Junio C Hamano21e7f9c2007-08-31 07:56:26128Save the process id in 'file'. Ignored when the daemon
129is run under `--inetd`.
Junio C Hamanoabb53dc2006-07-28 05:14:12130
Junio C Hamanoeb415992008-06-08 22:49:47131--user=user::
132--group=group::
Junio C Hamano9adfc6a2006-08-28 07:18:38133Change daemon's uid and gid before entering the service loop.
134When only `--user` is given without `--group`, the
135primary group ID for the user is used. The values of
136the option are given to `getpwnam(3)` and `getgrnam(3)`
137and numeric IDs are not supported.
138+
139Giving these options is an error when used with `--inetd`; use
140the facility of inet daemon to achieve the same before spawning
Junio C Hamanoba4b9282008-07-06 05:20:31141'git-daemon' if needed.
Junio C Hamano9adfc6a2006-08-28 07:18:38142
Junio C Hamanoeb415992008-06-08 22:49:47143--enable=service::
144--disable=service::
Junio C Hamano19ed3682006-09-07 11:44:08145Enable/disable the service site-wide per default. Note
146that a service disabled site-wide can still be enabled
147per repository if it is marked overridable and the
148repository enables the service with an configuration
149item.
150
Junio C Hamanoeb415992008-06-08 22:49:47151--allow-override=service::
152--forbid-override=service::
Junio C Hamano19ed3682006-09-07 11:44:08153Allow/forbid overriding the site-wide default with per
154repository configuration. By default, all the services
155are overridable.
156
Junio C Hamano1a4e8412005-12-27 08:17:23157<directory>::
158A directory to add to the whitelist of allowed directories. Unless
159--strict-paths is specified this will also include subdirectories
160of each named directory.
161
Junio C Hamano19ed3682006-09-07 11:44:08162SERVICES
163--------
164
Junio C Hamano21e7f9c2007-08-31 07:56:26165These services can be globally enabled/disabled using the
166command line options of this command. If a finer-grained
Junio C Hamanoba4b9282008-07-06 05:20:31167control is desired (e.g. to allow 'git-archive' to be run
Junio C Hamano21e7f9c2007-08-31 07:56:26168against only in a few selected repositories the daemon serves),
169the per-repository configuration file can be used to enable or
170disable them.
171
Junio C Hamano19ed3682006-09-07 11:44:08172upload-pack::
Junio C Hamanoba4b9282008-07-06 05:20:31173This serves 'git-fetch-pack' and 'git-ls-remote'
Junio C Hamano19ed3682006-09-07 11:44:08174clients. It is enabled by default, but a repository can
175disable it by setting `daemon.uploadpack` configuration
176item to `false`.
177
Junio C Hamanoa053d542006-10-27 09:29:13178upload-archive::
Junio C Hamanoba4b9282008-07-06 05:20:31179This serves 'git-archive --remote'. It is disabled by
Junio C Hamano21e7f9c2007-08-31 07:56:26180default, but a repository can enable it by setting
Junio C Hamanofeeb1be2008-05-22 00:53:35181`daemon.uploadarch` configuration item to `true`.
Junio C Hamano21e7f9c2007-08-31 07:56:26182
183receive-pack::
Junio C Hamanoba4b9282008-07-06 05:20:31184This serves 'git-send-pack' clients, allowing anonymous
Junio C Hamano21e7f9c2007-08-31 07:56:26185push. It is disabled by default, as there is _no_
186authentication in the protocol (in other words, anybody
187can push anything into the repository, including removal
188of refs). This is solely meant for a closed LAN setting
189where everybody is friendly. This service can be
190enabled by `daemon.receivepack` configuration item to
191`true`.
Junio C Hamanoa053d542006-10-27 09:29:13192
Junio C Hamano47c1e3c2006-09-25 04:45:55193EXAMPLES
194--------
Junio C Hamanoa053d542006-10-27 09:29:13195We assume the following in /etc/services::
196+
197------------
198$ grep 9418 /etc/services
199git 9418/tcp # Git Version Control System
200------------
201
Junio C Hamanoba4b9282008-07-06 05:20:31202'git-daemon' as inetd server::
203To set up 'git-daemon' as an inetd service that handles any
Junio C Hamano47c1e3c2006-09-25 04:45:55204repository under the whitelisted set of directories, /pub/foo
205and /pub/bar, place an entry like the following into
206/etc/inetd all on one line:
207+
208------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38209git stream tcp nowait nobody /usr/bin/git
210git daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55211/pub/foo /pub/bar
212------------------------------------------------
213
214
Junio C Hamanoba4b9282008-07-06 05:20:31215'git-daemon' as inetd server for virtual hosts::
216To set up 'git-daemon' as an inetd service that handles
Junio C Hamano47c1e3c2006-09-25 04:45:55217repositories for different virtual hosts, `www.example.com`
218and `www.example.org`, place an entry like the following into
219`/etc/inetd` all on one line:
220+
221------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38222git stream tcp nowait nobody /usr/bin/git
223git daemon --inetd --verbose --export-all
Junio C Hamano47c1e3c2006-09-25 04:45:55224--interpolated-path=/pub/%H%D
225/pub/www.example.org/software
226/pub/www.example.com/software
227/software
228------------------------------------------------
229+
230In this example, the root-level directory `/pub` will contain
231a subdirectory for each virtual host name supported.
232Further, both hosts advertise repositories simply as
233`git://www.example.com/software/repo.git`. For pre-1.4.0
234clients, a symlink from `/software` into the appropriate
235default repository could be made as well.
236
237
Junio C Hamanoba4b9282008-07-06 05:20:31238'git-daemon' as regular daemon for virtual hosts::
239To set up 'git-daemon' as a regular, non-inetd service that
Junio C Hamano032c6312006-09-28 07:39:18240handles repositories for multiple virtual hosts based on
241their IP addresses, start the daemon like this:
242+
243------------------------------------------------
Junio C Hamanofce7c7e2008-07-02 03:06:38244git daemon --verbose --export-all
Junio C Hamano032c6312006-09-28 07:39:18245--interpolated-path=/pub/%IP/%D
246/pub/192.168.1.200/software
247/pub/10.10.220.23/software
248------------------------------------------------
249+
250In this example, the root-level directory `/pub` will contain
251a subdirectory for each virtual host IP address supported.
252Repositories can still be accessed by hostname though, assuming
253they correspond to these IP addresses.
254
Junio C Hamanodbb64592007-09-01 11:17:39255selectively enable/disable services per repository::
Junio C Hamanoba4b9282008-07-06 05:20:31256To enable 'git-archive --remote' and disable 'git-fetch' against
Junio C Hamanodbb64592007-09-01 11:17:39257a repository, have the following in the configuration file in the
258repository (that is the file 'config' next to 'HEAD', 'refs' and
259'objects').
Junio C Hamano21e7f9c2007-08-31 07:56:26260+
261----------------------------------------------------------------
Junio C Hamanodbb64592007-09-01 11:17:39262[daemon]
263uploadpack = false
Junio C Hamanofeeb1be2008-05-22 00:53:35264uploadarch = true
Junio C Hamano21e7f9c2007-08-31 07:56:26265----------------------------------------------------------------
266
267
Junio C Hamano1a4e8412005-12-27 08:17:23268Author
269------
270Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
271<yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org>
272
273Documentation
274--------------
275Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
276
277GIT
278---
Junio C Hamanof7c042d2008-06-06 22:50:53279Part of the linkgit:git[1] suite