]>
Commit | Line | Data |
---|---|---|
7fc9d69f JH |
1 | git-daemon(1) |
2 | ============= | |
3 | ||
4 | NAME | |
5 | ---- | |
7bd7f280 | 6 | git-daemon - A really simple server for git repositories |
7fc9d69f JH |
7 | |
8 | SYNOPSIS | |
9 | -------- | |
353ce815 | 10 | [verse] |
b1889c36 | 11 | 'git daemon' [--verbose] [--syslog] [--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] |
dd467629 | 15 | [--reuseaddr] [--detach] [--pid-file=file] |
355f5412 JH |
16 | [--enable=service] [--disable=service] |
17 | [--allow-override=service] [--forbid-override=service] | |
dd467629 JL |
18 | [--inetd | [--listen=host_or_ipaddr] [--port=n] [--user=user [--group=group]] |
19 | [directory...] | |
7fc9d69f JH |
20 | |
21 | DESCRIPTION | |
22 | ----------- | |
62cd033d | 23 | A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT" |
355f5412 JH |
24 | aka 9418. It waits for a connection asking for a service, and will serve |
25 | that service if it is enabled. | |
7fc9d69f | 26 | |
62cd033d LAS |
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 | |
2707da9c PB |
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. | |
62cd033d | 32 | |
355f5412 | 33 | By default, only `upload-pack` service is enabled, which serves |
f0294272 JS |
34 | `git-fetch-pack` and `git-ls-remote` clients, which are invoked |
35 | from `git-fetch`, `git-pull`, and `git-clone`. | |
355f5412 JH |
36 | |
37 | This is ideally suited for read-only updates, i.e., pulling from | |
38 | git repositories. | |
7fc9d69f | 39 | |
e2b1d1cc CC |
40 | An `upload-archive` also exists to serve `git-archive`. |
41 | ||
7fc9d69f JH |
42 | OPTIONS |
43 | ------- | |
ce335fe0 | 44 | --strict-paths:: |
4dbd1352 AE |
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. | |
49 | ||
b21c31c9 PB |
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 | |
603968d2 | 55 | as '/srv/git/hello.git'. |
b21c31c9 | 56 | |
73a7a656 JA |
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. | |
62 | ||
49ba83fb JL |
63 | --interpolated-path=pathtemplate:: |
64 | To support virtual hosting, an interpolated path template can be | |
65 | used to dynamically construct alternate paths. The template | |
dd467629 JL |
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, | |
49ba83fb | 69 | and %D for the absolute path of the named repository. |
dd467629 JL |
70 | After interpolation, the path is validated against the directory |
71 | whitelist. | |
49ba83fb | 72 | |
2707da9c PB |
73 | --export-all:: |
74 | Allow pulling from all directories that look like GIT repositories | |
4dbd1352 | 75 | (have the 'objects' and 'refs' subdirectories), even if they |
2707da9c PB |
76 | do not have the 'git-daemon-export-ok' file. |
77 | ||
62cd033d | 78 | --inetd:: |
bce8230d | 79 | Have the server run as an inetd service. Implies --syslog. |
dd467629 JL |
80 | Incompatible with --port, --listen, --user and --group options. |
81 | ||
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. | |
7fc9d69f | 88 | |
dd467629 JL |
89 | --port=n:: |
90 | Listen on an alternative port. Incompatible with '--inetd' option. | |
7fc9d69f | 91 | |
2707da9c PB |
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). | |
96 | ||
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. | |
101 | ||
9048fe1c PB |
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. | |
105 | ||
3240240f SB |
106 | --user-path:: |
107 | --user-path=path:: | |
603968d2 JH |
108 | Allow ~user notation to be used in requests. When |
109 | specified with no parameter, requests to | |
110 | git://host/~alice/foo is taken as a request to access | |
111 | 'foo' repository in the home directory of user `alice`. | |
112 | If `--user-path=path` is specified, the same request is | |
113 | taken as a request to access `path/foo` repository in | |
114 | the home directory of user `alice`. | |
115 | ||
b5cf3c8b PB |
116 | --verbose:: |
117 | Log details about the incoming connections and requested files. | |
118 | ||
6c35119a ML |
119 | --reuseaddr:: |
120 | Use SO_REUSEADDR when binding the listening socket. | |
121 | This allows the server to restart without waiting for | |
122 | old connections to time out. | |
123 | ||
124 | --detach:: | |
125 | Detach from the shell. Implies --syslog. | |
126 | ||
127 | --pid-file=file:: | |
bdd73795 JH |
128 | Save the process id in 'file'. Ignored when the daemon |
129 | is run under `--inetd`. | |
6c35119a | 130 | |
3240240f SB |
131 | --user=user:: |
132 | --group=group:: | |
678dac6b TS |
133 | Change daemon's uid and gid before entering the service loop. |
134 | When only `--user` is given without `--group`, the | |
135 | primary group ID for the user is used. The values of | |
136 | the option are given to `getpwnam(3)` and `getgrnam(3)` | |
137 | and numeric IDs are not supported. | |
138 | + | |
139 | Giving these options is an error when used with `--inetd`; use | |
140 | the facility of inet daemon to achieve the same before spawning | |
141 | `git-daemon` if needed. | |
142 | ||
3240240f SB |
143 | --enable=service:: |
144 | --disable=service:: | |
355f5412 JH |
145 | Enable/disable the service site-wide per default. Note |
146 | that a service disabled site-wide can still be enabled | |
147 | per repository if it is marked overridable and the | |
148 | repository enables the service with an configuration | |
149 | item. | |
150 | ||
3240240f SB |
151 | --allow-override=service:: |
152 | --forbid-override=service:: | |
355f5412 JH |
153 | Allow/forbid overriding the site-wide default with per |
154 | repository configuration. By default, all the services | |
155 | are overridable. | |
156 | ||
4dbd1352 AE |
157 | <directory>:: |
158 | A directory to add to the whitelist of allowed directories. Unless | |
159 | --strict-paths is specified this will also include subdirectories | |
160 | of each named directory. | |
161 | ||
355f5412 JH |
162 | SERVICES |
163 | -------- | |
164 | ||
bdd73795 JH |
165 | These services can be globally enabled/disabled using the |
166 | command line options of this command. If a finer-grained | |
167 | control is desired (e.g. to allow `git-archive` to be run | |
168 | against only in a few selected repositories the daemon serves), | |
169 | the per-repository configuration file can be used to enable or | |
170 | disable them. | |
171 | ||
355f5412 | 172 | upload-pack:: |
f0294272 | 173 | This serves `git-fetch-pack` and `git-ls-remote` |
355f5412 JH |
174 | clients. It is enabled by default, but a repository can |
175 | disable it by setting `daemon.uploadpack` configuration | |
176 | item to `false`. | |
177 | ||
e2b1d1cc | 178 | upload-archive:: |
bdd73795 JH |
179 | This serves `git-archive --remote`. It is disabled by |
180 | default, but a repository can enable it by setting | |
74190d23 | 181 | `daemon.uploadarch` configuration item to `true`. |
bdd73795 JH |
182 | |
183 | receive-pack:: | |
184 | This serves `git-send-pack` clients, allowing anonymous | |
185 | push. It is disabled by default, as there is _no_ | |
186 | authentication in the protocol (in other words, anybody | |
187 | can push anything into the repository, including removal | |
188 | of refs). This is solely meant for a closed LAN setting | |
189 | where everybody is friendly. This service can be | |
190 | enabled by `daemon.receivepack` configuration item to | |
191 | `true`. | |
e2b1d1cc | 192 | |
49ba83fb JL |
193 | EXAMPLES |
194 | -------- | |
f8a5da6d CC |
195 | We assume the following in /etc/services:: |
196 | + | |
197 | ------------ | |
198 | $ grep 9418 /etc/services | |
199 | git 9418/tcp # Git Version Control System | |
200 | ------------ | |
201 | ||
49ba83fb JL |
202 | git-daemon as inetd server:: |
203 | To set up `git-daemon` as an inetd service that handles any | |
204 | repository under the whitelisted set of directories, /pub/foo | |
205 | and /pub/bar, place an entry like the following into | |
206 | /etc/inetd all on one line: | |
207 | + | |
208 | ------------------------------------------------ | |
963a653f JN |
209 | git stream tcp nowait nobody /usr/bin/git |
210 | git daemon --inetd --verbose --export-all | |
49ba83fb JL |
211 | /pub/foo /pub/bar |
212 | ------------------------------------------------ | |
213 | ||
214 | ||
215 | git-daemon as inetd server for virtual hosts:: | |
216 | To set up `git-daemon` as an inetd service that handles | |
217 | repositories for different virtual hosts, `www.example.com` | |
218 | and `www.example.org`, place an entry like the following into | |
219 | `/etc/inetd` all on one line: | |
220 | + | |
221 | ------------------------------------------------ | |
963a653f JN |
222 | git stream tcp nowait nobody /usr/bin/git |
223 | git daemon --inetd --verbose --export-all | |
49ba83fb JL |
224 | --interpolated-path=/pub/%H%D |
225 | /pub/www.example.org/software | |
226 | /pub/www.example.com/software | |
227 | /software | |
228 | ------------------------------------------------ | |
229 | + | |
230 | In this example, the root-level directory `/pub` will contain | |
231 | a subdirectory for each virtual host name supported. | |
232 | Further, both hosts advertise repositories simply as | |
233 | `git://www.example.com/software/repo.git`. For pre-1.4.0 | |
234 | clients, a symlink from `/software` into the appropriate | |
235 | default repository could be made as well. | |
236 | ||
237 | ||
dd467629 JL |
238 | git-daemon as regular daemon for virtual hosts:: |
239 | To set up `git-daemon` as a regular, non-inetd service that | |
240 | handles repositories for multiple virtual hosts based on | |
241 | their IP addresses, start the daemon like this: | |
242 | + | |
243 | ------------------------------------------------ | |
963a653f | 244 | git daemon --verbose --export-all |
dd467629 JL |
245 | --interpolated-path=/pub/%IP/%D |
246 | /pub/192.168.1.200/software | |
247 | /pub/10.10.220.23/software | |
248 | ------------------------------------------------ | |
249 | + | |
250 | In this example, the root-level directory `/pub` will contain | |
251 | a subdirectory for each virtual host IP address supported. | |
252 | Repositories can still be accessed by hostname though, assuming | |
253 | they correspond to these IP addresses. | |
254 | ||
f368f5a6 JH |
255 | selectively enable/disable services per repository:: |
256 | To enable `git-archive --remote` and disable `git-fetch` against | |
257 | a repository, have the following in the configuration file in the | |
258 | repository (that is the file 'config' next to 'HEAD', 'refs' and | |
259 | 'objects'). | |
bdd73795 JH |
260 | + |
261 | ---------------------------------------------------------------- | |
f368f5a6 JH |
262 | [daemon] |
263 | uploadpack = false | |
74190d23 | 264 | uploadarch = true |
bdd73795 JH |
265 | ---------------------------------------------------------------- |
266 | ||
267 | ||
7fc9d69f JH |
268 | Author |
269 | ------ | |
4dbd1352 AE |
270 | Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki |
271 | <yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org> | |
7fc9d69f JH |
272 | |
273 | Documentation | |
274 | -------------- | |
275 | Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. | |
276 | ||
277 | GIT | |
278 | --- | |
9e1f0a85 | 279 | Part of the linkgit:git[1] suite |