grep: fix --fixed-strings combined with expression.
[git/git.git] / Documentation / git-daemon.txt
CommitLineData
7fc9d69f
JH
1git-daemon(1)
2=============
3
4NAME
5----
7bd7f280 6git-daemon - A really simple server for git repositories
7fc9d69f
JH
7
8SYNOPSIS
9--------
353ce815 10[verse]
2707da9c 11'git-daemon' [--verbose] [--syslog] [--inetd | --port=n] [--export-all]
b21c31c9 12 [--timeout=n] [--init-timeout=n] [--strict-paths]
603968d2 13 [--base-path=path] [--user-path | --user-path=path]
49ba83fb 14 [--interpolated-path=pathtemplate]
355f5412
JH
15 [--enable=service] [--disable=service]
16 [--allow-override=service] [--forbid-override=service]
17 [--reuseaddr] [--detach] [--pid-file=file]
18 [--user=user [--group=group]] [directory...]
7fc9d69f
JH
19
20DESCRIPTION
21-----------
62cd033d 22A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
355f5412
JH
23aka 9418. It waits for a connection asking for a service, and will serve
24that service if it is enabled.
7fc9d69f 25
62cd033d
LAS
26It verifies that the directory has the magic file "git-daemon-export-ok", and
27it will refuse to export any git directory that hasn't explicitly been marked
2707da9c
PB
28for export this way (unless the '--export-all' parameter is specified). If you
29pass some directory paths as 'git-daemon' arguments, you can further restrict
30the offers to a whitelist comprising of those.
62cd033d 31
355f5412
JH
32By default, only `upload-pack` service is enabled, which serves
33`git-fetch-pack` and `git-peek-remote` clients that are invoked
34from `git-fetch`, `git-ls-remote`, and `git-clone`.
35
36This is ideally suited for read-only updates, i.e., pulling from
37git repositories.
7fc9d69f
JH
38
39OPTIONS
40-------
ce335fe0 41--strict-paths::
4dbd1352
AE
42 Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
43 "/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
44 git-daemon will refuse to start when this option is enabled and no
45 whitelist is specified.
46
b21c31c9
PB
47--base-path::
48 Remap all the path requests as relative to the given path.
49 This is sort of "GIT root" - if you run git-daemon with
50 '--base-path=/srv/git' on example.com, then if you later try to pull
51 'git://example.com/hello.git', `git-daemon` will interpret the path
603968d2 52 as '/srv/git/hello.git'.
b21c31c9 53
49ba83fb
JL
54--interpolated-path=pathtemplate::
55 To support virtual hosting, an interpolated path template can be
56 used to dynamically construct alternate paths. The template
57 supports %H for the target hostname as supplied by the client,
58 and %D for the absolute path of the named repository.
59
2707da9c
PB
60--export-all::
61 Allow pulling from all directories that look like GIT repositories
4dbd1352 62 (have the 'objects' and 'refs' subdirectories), even if they
2707da9c
PB
63 do not have the 'git-daemon-export-ok' file.
64
62cd033d 65--inetd::
bce8230d 66 Have the server run as an inetd service. Implies --syslog.
7fc9d69f 67
62cd033d
LAS
68--port::
69 Listen on an alternative port.
7fc9d69f 70
2707da9c
PB
71--init-timeout::
72 Timeout between the moment the connection is established and the
73 client request is received (typically a rather low value, since
74 that should be basically immediate).
75
76--timeout::
77 Timeout for specific client sub-requests. This includes the time
78 it takes for the server to process the sub-request and time spent
79 waiting for next client's request.
80
9048fe1c
PB
81--syslog::
82 Log to syslog instead of stderr. Note that this option does not imply
83 --verbose, thus by default only error conditions will be logged.
84
603968d2
JH
85--user-path, --user-path=path::
86 Allow ~user notation to be used in requests. When
87 specified with no parameter, requests to
88 git://host/~alice/foo is taken as a request to access
89 'foo' repository in the home directory of user `alice`.
90 If `--user-path=path` is specified, the same request is
91 taken as a request to access `path/foo` repository in
92 the home directory of user `alice`.
93
b5cf3c8b
PB
94--verbose::
95 Log details about the incoming connections and requested files.
96
6c35119a
ML
97--reuseaddr::
98 Use SO_REUSEADDR when binding the listening socket.
99 This allows the server to restart without waiting for
100 old connections to time out.
101
102--detach::
103 Detach from the shell. Implies --syslog.
104
105--pid-file=file::
106 Save the process id in 'file'.
107
678dac6b
TS
108--user=user, --group=group::
109 Change daemon's uid and gid before entering the service loop.
110 When only `--user` is given without `--group`, the
111 primary group ID for the user is used. The values of
112 the option are given to `getpwnam(3)` and `getgrnam(3)`
113 and numeric IDs are not supported.
114+
115Giving these options is an error when used with `--inetd`; use
116the facility of inet daemon to achieve the same before spawning
117`git-daemon` if needed.
118
355f5412
JH
119--enable-service, --disable-service::
120 Enable/disable the service site-wide per default. Note
121 that a service disabled site-wide can still be enabled
122 per repository if it is marked overridable and the
123 repository enables the service with an configuration
124 item.
125
126--allow-override, --forbid-override::
127 Allow/forbid overriding the site-wide default with per
128 repository configuration. By default, all the services
129 are overridable.
130
4dbd1352
AE
131<directory>::
132 A directory to add to the whitelist of allowed directories. Unless
133 --strict-paths is specified this will also include subdirectories
134 of each named directory.
135
355f5412
JH
136SERVICES
137--------
138
139upload-pack::
140 This serves `git-fetch-pack` and `git-peek-remote`
141 clients. It is enabled by default, but a repository can
142 disable it by setting `daemon.uploadpack` configuration
143 item to `false`.
144
49ba83fb
JL
145EXAMPLES
146--------
147git-daemon as inetd server::
148 To set up `git-daemon` as an inetd service that handles any
149 repository under the whitelisted set of directories, /pub/foo
150 and /pub/bar, place an entry like the following into
151 /etc/inetd all on one line:
152+
153------------------------------------------------
154 git stream tcp nowait nobody /usr/bin/git-daemon
155 git-daemon --inetd --verbose
156 --syslog --export-all
157 /pub/foo /pub/bar
158------------------------------------------------
159
160
161git-daemon as inetd server for virtual hosts::
162 To set up `git-daemon` as an inetd service that handles
163 repositories for different virtual hosts, `www.example.com`
164 and `www.example.org`, place an entry like the following into
165 `/etc/inetd` all on one line:
166+
167------------------------------------------------
168 git stream tcp nowait nobody /usr/bin/git-daemon
169 git-daemon --inetd --verbose
170 --syslog --export-all
171 --interpolated-path=/pub/%H%D
172 /pub/www.example.org/software
173 /pub/www.example.com/software
174 /software
175------------------------------------------------
176+
177In this example, the root-level directory `/pub` will contain
178a subdirectory for each virtual host name supported.
179Further, both hosts advertise repositories simply as
180`git://www.example.com/software/repo.git`. For pre-1.4.0
181clients, a symlink from `/software` into the appropriate
182default repository could be made as well.
183
184
7fc9d69f
JH
185Author
186------
4dbd1352
AE
187Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
188<yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org>
7fc9d69f
JH
189
190Documentation
191--------------
192Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
193
194GIT
195---
a7154e91 196Part of the gitlink:git[7] suite
7fc9d69f 197