gitweb: Fix escaping HTML of project owner in 'projects_list' and
[git/dscho.git] / Documentation / git-daemon.txt
blobf902161c087a34d4e244a516cc6dd2e259af2e2e
1 git-daemon(1)
2 =============
4 NAME
5 ----
6 git-daemon - A really simple server for git repositories
8 SYNOPSIS
9 --------
10 [verse]
11 '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]
17              [--allow-override=service] [--forbid-override=service]
18              [--inetd | [--listen=host_or_ipaddr] [--port=n] [--user=user [--group=group]]
19              [directory...]
21 DESCRIPTION
22 -----------
23 A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
24 aka 9418.  It waits for a connection asking for a service, and will serve
25 that service if it is enabled.
27 It verifies that the directory has the magic file "git-daemon-export-ok", and
28 it will refuse to export any git directory that hasn't explicitly been marked
29 for export this way (unless the '--export-all' parameter is specified). If you
30 pass some directory paths as 'git-daemon' arguments, you can further restrict
31 the offers to a whitelist comprising of those.
33 By default, only `upload-pack` service is enabled, which serves
34 `git-fetch-pack` and `git-peek-remote` clients that are invoked
35 from `git-fetch`, `git-ls-remote`, and `git-clone`.
37 This is ideally suited for read-only updates, i.e., pulling from
38 git repositories.
40 An `upload-archive` also exists to serve `git-archive`.
42 OPTIONS
43 -------
44 --strict-paths::
45         Match 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.
47         git-daemon will refuse to start when this option is enabled and no
48         whitelist is specified.
50 --base-path::
51         Remap all the path requests as relative to the given path.
52         This is sort of "GIT root" - if you run git-daemon with
53         '--base-path=/srv/git' on example.com, then if you later try to pull
54         'git://example.com/hello.git', `git-daemon` will interpret the path
55         as '/srv/git/hello.git'.
57 --base-path-relaxed::
58         If --base-path is enabled and repo lookup fails, with this option
59         `git-daemon` will attempt to lookup without prefixing the base path.
60         This is useful for switching to --base-path usage, while still
61         allowing the old paths.
63 --interpolated-path=pathtemplate::
64         To support virtual hosting, an interpolated path template can be
65         used to dynamically construct alternate paths.  The template
66         supports %H for the target hostname as supplied by the client but
67         converted to all lowercase, %CH for the canonical hostname,
68         %IP for the server's IP address, %P for the port number,
69         and %D for the absolute path of the named repository.
70         After interpolation, the path is validated against the directory
71         whitelist.
73 --export-all::
74         Allow pulling from all directories that look like GIT repositories
75         (have the 'objects' and 'refs' subdirectories), even if they
76         do not have the 'git-daemon-export-ok' file.
78 --inetd::
79         Have the server run as an inetd service. Implies --syslog.
80         Incompatible with --port, --listen, --user and --group options.
82 --listen=host_or_ipaddr::
83         Listen on an a specific IP address or hostname.  IP addresses can
84         be either an IPv4 address or an IPV6 address if supported.  If IPv6
85         is not supported, then --listen=hostname is also not supported and
86         --listen must be given an IPv4 address.
87         Incompatible with '--inetd' option.
89 --port=n::
90         Listen on an alternative port.  Incompatible with '--inetd' option.
92 --init-timeout::
93         Timeout between the moment the connection is established and the
94         client request is received (typically a rather low value, since
95         that should be basically immediate).
97 --timeout::
98         Timeout for specific client sub-requests. This includes the time
99         it takes for the server to process the sub-request and time spent
100         waiting for next client's request.
102 --syslog::
103         Log to syslog instead of stderr. Note that this option does not imply
104         --verbose, thus by default only error conditions will be logged.
106 --user-path, --user-path=path::
107         Allow ~user notation to be used in requests.  When
108         specified with no parameter, requests to
109         git://host/~alice/foo is taken as a request to access
110         'foo' repository in the home directory of user `alice`.
111         If `--user-path=path` is specified, the same request is
112         taken as a request to access `path/foo` repository in
113         the home directory of user `alice`.
115 --verbose::
116         Log details about the incoming connections and requested files.
118 --reuseaddr::
119         Use SO_REUSEADDR when binding the listening socket.
120         This allows the server to restart without waiting for
121         old connections to time out.
123 --detach::
124         Detach from the shell. Implies --syslog.
126 --pid-file=file::
127         Save the process id in 'file'.
129 --user=user, --group=group::
130         Change daemon's uid and gid before entering the service loop.
131         When only `--user` is given without `--group`, the
132         primary group ID for the user is used.  The values of
133         the option are given to `getpwnam(3)` and `getgrnam(3)`
134         and numeric IDs are not supported.
136 Giving these options is an error when used with `--inetd`; use
137 the facility of inet daemon to achieve the same before spawning
138 `git-daemon` if needed.
140 --enable=service, --disable=service::
141         Enable/disable the service site-wide per default.  Note
142         that a service disabled site-wide can still be enabled
143         per repository if it is marked overridable and the
144         repository enables the service with an configuration
145         item.
147 --allow-override=service, --forbid-override=service::
148         Allow/forbid overriding the site-wide default with per
149         repository configuration.  By default, all the services
150         are overridable.
152 <directory>::
153         A directory to add to the whitelist of allowed directories. Unless
154         --strict-paths is specified this will also include subdirectories
155         of each named directory.
157 SERVICES
158 --------
160 upload-pack::
161         This serves `git-fetch-pack` and `git-peek-remote`
162         clients.  It is enabled by default, but a repository can
163         disable it by setting `daemon.uploadpack` configuration
164         item to `false`.
166 upload-archive::
167         This serves `git-archive --remote`.
169 EXAMPLES
170 --------
171 We assume the following in /etc/services::
173 ------------
174 $ grep 9418 /etc/services
175 git             9418/tcp                # Git Version Control System
176 ------------
178 git-daemon as inetd server::
179         To set up `git-daemon` as an inetd service that handles any
180         repository under the whitelisted set of directories, /pub/foo
181         and /pub/bar, place an entry like the following into
182         /etc/inetd all on one line:
184 ------------------------------------------------
185         git stream tcp nowait nobody  /usr/bin/git-daemon
186                 git-daemon --inetd --verbose --export-all
187                 /pub/foo /pub/bar
188 ------------------------------------------------
191 git-daemon as inetd server for virtual hosts::
192         To set up `git-daemon` as an inetd service that handles
193         repositories for different virtual hosts, `www.example.com`
194         and `www.example.org`, place an entry like the following into
195         `/etc/inetd` all on one line:
197 ------------------------------------------------
198         git stream tcp nowait nobody /usr/bin/git-daemon
199                 git-daemon --inetd --verbose --export-all
200                 --interpolated-path=/pub/%H%D
201                 /pub/www.example.org/software
202                 /pub/www.example.com/software
203                 /software
204 ------------------------------------------------
206 In this example, the root-level directory `/pub` will contain
207 a subdirectory for each virtual host name supported.
208 Further, both hosts advertise repositories simply as
209 `git://www.example.com/software/repo.git`.  For pre-1.4.0
210 clients, a symlink from `/software` into the appropriate
211 default repository could be made as well.
214 git-daemon as regular daemon for virtual hosts::
215         To set up `git-daemon` as a regular, non-inetd service that
216         handles repositories for multiple virtual hosts based on
217         their IP addresses, start the daemon like this:
219 ------------------------------------------------
220         git-daemon --verbose --export-all
221                 --interpolated-path=/pub/%IP/%D
222                 /pub/192.168.1.200/software
223                 /pub/10.10.220.23/software
224 ------------------------------------------------
226 In this example, the root-level directory `/pub` will contain
227 a subdirectory for each virtual host IP address supported.
228 Repositories can still be accessed by hostname though, assuming
229 they correspond to these IP addresses.
232 Author
233 ------
234 Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
235 <yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org>
237 Documentation
238 --------------
239 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
243 Part of the gitlink:git[7] suite