blob: d562232e522fba78721328b1c76ce08490b0ee3e [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 Hamano032c6312006-09-28 07:39:1811'git-daemon' [--verbose] [--syslog] [--export-all]
Junio C Hamano4d04a402006-01-09 00:53:2812 [--timeout=n] [--init-timeout=n] [--strict-paths]
Junio C Hamano70fafca2006-02-06 08:02:0113 [--base-path=path] [--user-path | --user-path=path]
Junio C Hamano47c1e3c2006-09-25 04:45:5514 [--interpolated-path=pathtemplate]
Junio C Hamano032c6312006-09-28 07:39:1815 [--reuseaddr] [--detach] [--pid-file=file]
Junio C Hamano19ed3682006-09-07 11:44:0816 [--enable=service] [--disable=service]
17 [--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
30pass some directory paths as 'git-daemon' arguments, you can further restrict
31the 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
34`git-fetch-pack` and `git-peek-remote` clients that are invoked
35from `git-fetch`, `git-ls-remote`, and `git-clone`.
36
37This is ideally suited for read-only updates, i.e., pulling from
38git repositories.
Junio C Hamano1a4e8412005-12-27 08:17:2339
40OPTIONS
41-------
42--strict-paths::
43Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
44"/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
45git-daemon will refuse to start when this option is enabled and no
46whitelist is specified.
47
Junio C Hamano4d04a402006-01-09 00:53:2848--base-path::
49Remap all the path requests as relative to the given path.
50This is sort of "GIT root" - if you run git-daemon with
51'--base-path=/srv/git' on example.com, then if you later try to pull
52'git://example.com/hello.git', `git-daemon` will interpret the path
Junio C Hamano70fafca2006-02-06 08:02:0153as '/srv/git/hello.git'.
Junio C Hamano4d04a402006-01-09 00:53:2854
Junio C Hamano47c1e3c2006-09-25 04:45:5555--interpolated-path=pathtemplate::
56To support virtual hosting, an interpolated path template can be
57used to dynamically construct alternate paths. The template
Junio C Hamano032c6312006-09-28 07:39:1858supports %H for the target hostname as supplied by the client but
59converted to all lowercase, %CH for the canonical hostname,
60%IP for the server's IP address, %P for the port number,
Junio C Hamano47c1e3c2006-09-25 04:45:5561and %D for the absolute path of the named repository.
Junio C Hamano032c6312006-09-28 07:39:1862After interpolation, the path is validated against the directory
63whitelist.
Junio C Hamano47c1e3c2006-09-25 04:45:5564
Junio C Hamano1a4e8412005-12-27 08:17:2365--export-all::
66Allow pulling from all directories that look like GIT repositories
67(have the 'objects' and 'refs' subdirectories), even if they
68do not have the 'git-daemon-export-ok' file.
69
70--inetd::
71Have the server run as an inetd service. Implies --syslog.
Junio C Hamano032c6312006-09-28 07:39:1872Incompatible with --port, --listen, --user and --group options.
Junio C Hamano1a4e8412005-12-27 08:17:2373
Junio C Hamano032c6312006-09-28 07:39:1874--listen=host_or_ipaddr::
75Listen on an a specific IP address or hostname. IP addresses can
76be either an IPv4 address or an IPV6 address if supported. If IPv6
77is not supported, then --listen=hostname is also not supported and
78--listen must be given an IPv4 address.
79Incompatible with '--inetd' option.
80
81--port=n::
82Listen on an alternative port. Incompatible with '--inetd' option.
Junio C Hamano1a4e8412005-12-27 08:17:2383
84--init-timeout::
85Timeout between the moment the connection is established and the
86client request is received (typically a rather low value, since
87that should be basically immediate).
88
89--timeout::
90Timeout for specific client sub-requests. This includes the time
91it takes for the server to process the sub-request and time spent
92waiting for next client's request.
93
94--syslog::
95Log to syslog instead of stderr. Note that this option does not imply
96--verbose, thus by default only error conditions will be logged.
97
Junio C Hamano70fafca2006-02-06 08:02:0198--user-path, --user-path=path::
99Allow ~user notation to be used in requests. When
100specified with no parameter, requests to
101git://host/~alice/foo is taken as a request to access
102'foo' repository in the home directory of user `alice`.
103If `--user-path=path` is specified, the same request is
104taken as a request to access `path/foo` repository in
105the home directory of user `alice`.
106
Junio C Hamano1a4e8412005-12-27 08:17:23107--verbose::
108Log details about the incoming connections and requested files.
109
Junio C Hamanoabb53dc2006-07-28 05:14:12110--reuseaddr::
111Use SO_REUSEADDR when binding the listening socket.
112This allows the server to restart without waiting for
113old connections to time out.
114
115--detach::
116Detach from the shell. Implies --syslog.
117
118--pid-file=file::
119Save the process id in 'file'.
120
Junio C Hamano9adfc6a2006-08-28 07:18:38121--user=user, --group=group::
122Change daemon's uid and gid before entering the service loop.
123When only `--user` is given without `--group`, the
124primary group ID for the user is used. The values of
125the option are given to `getpwnam(3)` and `getgrnam(3)`
126and numeric IDs are not supported.
127+
128Giving these options is an error when used with `--inetd`; use
129the facility of inet daemon to achieve the same before spawning
130`git-daemon` if needed.
131
Junio C Hamano19ed3682006-09-07 11:44:08132--enable-service, --disable-service::
133Enable/disable the service site-wide per default. Note
134that a service disabled site-wide can still be enabled
135per repository if it is marked overridable and the
136repository enables the service with an configuration
137item.
138
139--allow-override, --forbid-override::
140Allow/forbid overriding the site-wide default with per
141repository configuration. By default, all the services
142are overridable.
143
Junio C Hamano1a4e8412005-12-27 08:17:23144<directory>::
145A directory to add to the whitelist of allowed directories. Unless
146--strict-paths is specified this will also include subdirectories
147of each named directory.
148
Junio C Hamano19ed3682006-09-07 11:44:08149SERVICES
150--------
151
152upload-pack::
153This serves `git-fetch-pack` and `git-peek-remote`
154clients. It is enabled by default, but a repository can
155disable it by setting `daemon.uploadpack` configuration
156item to `false`.
157
Junio C Hamano47c1e3c2006-09-25 04:45:55158EXAMPLES
159--------
160git-daemon as inetd server::
161To set up `git-daemon` as an inetd service that handles any
162repository under the whitelisted set of directories, /pub/foo
163and /pub/bar, place an entry like the following into
164/etc/inetd all on one line:
165+
166------------------------------------------------
167git stream tcp nowait nobody /usr/bin/git-daemon
168git-daemon --inetd --verbose
169--syslog --export-all
170/pub/foo /pub/bar
171------------------------------------------------
172
173
174git-daemon as inetd server for virtual hosts::
175To set up `git-daemon` as an inetd service that handles
176repositories for different virtual hosts, `www.example.com`
177and `www.example.org`, place an entry like the following into
178`/etc/inetd` all on one line:
179+
180------------------------------------------------
181git stream tcp nowait nobody /usr/bin/git-daemon
182git-daemon --inetd --verbose
183--syslog --export-all
184--interpolated-path=/pub/%H%D
185/pub/www.example.org/software
186/pub/www.example.com/software
187/software
188------------------------------------------------
189+
190In this example, the root-level directory `/pub` will contain
191a subdirectory for each virtual host name supported.
192Further, both hosts advertise repositories simply as
193`git://www.example.com/software/repo.git`. For pre-1.4.0
194clients, a symlink from `/software` into the appropriate
195default repository could be made as well.
196
197
Junio C Hamano032c6312006-09-28 07:39:18198git-daemon as regular daemon for virtual hosts::
199To set up `git-daemon` as a regular, non-inetd service that
200handles repositories for multiple virtual hosts based on
201their IP addresses, start the daemon like this:
202+
203------------------------------------------------
204git-daemon --verbose --export-all
205--interpolated-path=/pub/%IP/%D
206/pub/192.168.1.200/software
207/pub/10.10.220.23/software
208------------------------------------------------
209+
210In this example, the root-level directory `/pub` will contain
211a subdirectory for each virtual host IP address supported.
212Repositories can still be accessed by hostname though, assuming
213they correspond to these IP addresses.
214
215
Junio C Hamano1a4e8412005-12-27 08:17:23216Author
217------
218Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
219<yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org>
220
221Documentation
222--------------
223Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
224
225GIT
226---
227Part of the gitlink:git[7] suite
228