]> git.ipfire.org Git - thirdparty/git.git/blob - Documentation/git-daemon.txt
Add virtualization support to git-daemon
[thirdparty/git.git] / Documentation / git-daemon.txt
1 git-daemon(1)
2 =============
3
4 NAME
5 ----
6 git-daemon - A really simple server for git repositories
7
8 SYNOPSIS
9 --------
10 [verse]
11 'git-daemon' [--verbose] [--syslog] [--inetd | --port=n] [--export-all]
12 [--timeout=n] [--init-timeout=n] [--strict-paths]
13 [--base-path=path] [--user-path | --user-path=path]
14 [--interpolated-path=pathtemplate]
15 [--enable=service] [--disable=service]
16 [--allow-override=service] [--forbid-override=service]
17 [--reuseaddr] [--detach] [--pid-file=file]
18 [--user=user [--group=group]] [directory...]
19
20 DESCRIPTION
21 -----------
22 A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT"
23 aka 9418. It waits for a connection asking for a service, and will serve
24 that service if it is enabled.
25
26 It verifies that the directory has the magic file "git-daemon-export-ok", and
27 it will refuse to export any git directory that hasn't explicitly been marked
28 for export this way (unless the '--export-all' parameter is specified). If you
29 pass some directory paths as 'git-daemon' arguments, you can further restrict
30 the offers to a whitelist comprising of those.
31
32 By default, only `upload-pack` service is enabled, which serves
33 `git-fetch-pack` and `git-peek-remote` clients that are invoked
34 from `git-fetch`, `git-ls-remote`, and `git-clone`.
35
36 This is ideally suited for read-only updates, i.e., pulling from
37 git repositories.
38
39 OPTIONS
40 -------
41 --strict-paths::
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
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
52 as '/srv/git/hello.git'.
53
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
60 --export-all::
61 Allow pulling from all directories that look like GIT repositories
62 (have the 'objects' and 'refs' subdirectories), even if they
63 do not have the 'git-daemon-export-ok' file.
64
65 --inetd::
66 Have the server run as an inetd service. Implies --syslog.
67
68 --port::
69 Listen on an alternative port.
70
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
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
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
94 --verbose::
95 Log details about the incoming connections and requested files.
96
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
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 +
115 Giving these options is an error when used with `--inetd`; use
116 the facility of inet daemon to achieve the same before spawning
117 `git-daemon` if needed.
118
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
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
136 SERVICES
137 --------
138
139 upload-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
145 EXAMPLES
146 --------
147 git-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
161 git-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 +
177 In this example, the root-level directory `/pub` will contain
178 a subdirectory for each virtual host name supported.
179 Further, both hosts advertise repositories simply as
180 `git://www.example.com/software/repo.git`. For pre-1.4.0
181 clients, a symlink from `/software` into the appropriate
182 default repository could be made as well.
183
184
185 Author
186 ------
187 Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki
188 <yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org>
189
190 Documentation
191 --------------
192 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
193
194 GIT
195 ---
196 Part of the gitlink:git[7] suite
197