Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-daemon(1) |
| 2 | ============= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 0107892 | 2006-03-10 00:31:47 | [diff] [blame] | 6 | git-daemon - A really simple server for git repositories |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 10 | [verse] |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 11 | 'git-daemon' [--verbose] [--syslog] [--export-all] |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 12 | [--timeout=n] [--init-timeout=n] [--strict-paths] |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 13 | [--base-path=path] [--user-path | --user-path=path] |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 14 | [--interpolated-path=pathtemplate] |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 15 | [--reuseaddr] [--detach] [--pid-file=file] |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 16 | [--enable=service] [--disable=service] |
| 17 | [--allow-override=service] [--forbid-override=service] |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 18 | [--inetd | [--listen=host_or_ipaddr] [--port=n] [--user=user [--group=group]] |
| 19 | [directory...] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 20 | |
| 21 | DESCRIPTION |
| 22 | ----------- |
| 23 | A really simple TCP git daemon that normally listens on port "DEFAULT_GIT_PORT" |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 24 | aka 9418. It waits for a connection asking for a service, and will serve |
| 25 | that service if it is enabled. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 26 | |
| 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. |
| 32 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 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`. |
| 36 | |
| 37 | This is ideally suited for read-only updates, i.e., pulling from |
| 38 | git repositories. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 39 | |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 40 | An `upload-archive` also exists to serve `git-archive`. |
| 41 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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. |
| 49 | |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 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 |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 55 | as '/srv/git/hello.git'. |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 56 | |
Junio C Hamano | 0ddc94d | 2007-08-01 08:42:39 | [diff] [blame] | 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 | |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 63 | --interpolated-path=pathtemplate:: |
| 64 | To support virtual hosting, an interpolated path template can be |
| 65 | used to dynamically construct alternate paths. The template |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 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, |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 69 | and %D for the absolute path of the named repository. |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 70 | After interpolation, the path is validated against the directory |
| 71 | whitelist. |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 72 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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. |
| 77 | |
| 78 | --inetd:: |
| 79 | Have the server run as an inetd service. Implies --syslog. |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 80 | Incompatible with --port, --listen, --user and --group options. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 81 | |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 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. |
| 88 | |
| 89 | --port=n:: |
| 90 | Listen on an alternative port. Incompatible with '--inetd' option. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 91 | |
| 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 | |
| 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 | |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 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`. |
| 114 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 115 | --verbose:: |
| 116 | Log details about the incoming connections and requested files. |
| 117 | |
Junio C Hamano | abb53dc | 2006-07-28 05:14:12 | [diff] [blame] | 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. |
| 122 | |
| 123 | --detach:: |
| 124 | Detach from the shell. Implies --syslog. |
| 125 | |
| 126 | --pid-file=file:: |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 127 | Save the process id in 'file'. Ignored when the daemon |
| 128 | is run under `--inetd`. |
Junio C Hamano | abb53dc | 2006-07-28 05:14:12 | [diff] [blame] | 129 | |
Junio C Hamano | 9adfc6a | 2006-08-28 07:18:38 | [diff] [blame] | 130 | --user=user, --group=group:: |
| 131 | Change daemon's uid and gid before entering the service loop. |
| 132 | When only `--user` is given without `--group`, the |
| 133 | primary group ID for the user is used. The values of |
| 134 | the option are given to `getpwnam(3)` and `getgrnam(3)` |
| 135 | and numeric IDs are not supported. |
| 136 | + |
| 137 | Giving these options is an error when used with `--inetd`; use |
| 138 | the facility of inet daemon to achieve the same before spawning |
| 139 | `git-daemon` if needed. |
| 140 | |
Junio C Hamano | fa0d4cf | 2007-01-25 02:23:58 | [diff] [blame] | 141 | --enable=service, --disable=service:: |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 142 | Enable/disable the service site-wide per default. Note |
| 143 | that a service disabled site-wide can still be enabled |
| 144 | per repository if it is marked overridable and the |
| 145 | repository enables the service with an configuration |
| 146 | item. |
| 147 | |
Junio C Hamano | fa0d4cf | 2007-01-25 02:23:58 | [diff] [blame] | 148 | --allow-override=service, --forbid-override=service:: |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 149 | Allow/forbid overriding the site-wide default with per |
| 150 | repository configuration. By default, all the services |
| 151 | are overridable. |
| 152 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 153 | <directory>:: |
| 154 | A directory to add to the whitelist of allowed directories. Unless |
| 155 | --strict-paths is specified this will also include subdirectories |
| 156 | of each named directory. |
| 157 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 158 | SERVICES |
| 159 | -------- |
| 160 | |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 161 | These services can be globally enabled/disabled using the |
| 162 | command line options of this command. If a finer-grained |
| 163 | control is desired (e.g. to allow `git-archive` to be run |
| 164 | against only in a few selected repositories the daemon serves), |
| 165 | the per-repository configuration file can be used to enable or |
| 166 | disable them. |
| 167 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 168 | upload-pack:: |
| 169 | This serves `git-fetch-pack` and `git-peek-remote` |
| 170 | clients. It is enabled by default, but a repository can |
| 171 | disable it by setting `daemon.uploadpack` configuration |
| 172 | item to `false`. |
| 173 | |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 174 | upload-archive:: |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 175 | This serves `git-archive --remote`. It is disabled by |
| 176 | default, but a repository can enable it by setting |
| 177 | `daemon.uploadarchive` configuration item to `true`. |
| 178 | |
| 179 | receive-pack:: |
| 180 | This serves `git-send-pack` clients, allowing anonymous |
| 181 | push. It is disabled by default, as there is _no_ |
| 182 | authentication in the protocol (in other words, anybody |
| 183 | can push anything into the repository, including removal |
| 184 | of refs). This is solely meant for a closed LAN setting |
| 185 | where everybody is friendly. This service can be |
| 186 | enabled by `daemon.receivepack` configuration item to |
| 187 | `true`. |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 188 | |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 189 | EXAMPLES |
| 190 | -------- |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 191 | We assume the following in /etc/services:: |
| 192 | + |
| 193 | ------------ |
| 194 | $ grep 9418 /etc/services |
| 195 | git 9418/tcp # Git Version Control System |
| 196 | ------------ |
| 197 | |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 198 | git-daemon as inetd server:: |
| 199 | To set up `git-daemon` as an inetd service that handles any |
| 200 | repository under the whitelisted set of directories, /pub/foo |
| 201 | and /pub/bar, place an entry like the following into |
| 202 | /etc/inetd all on one line: |
| 203 | + |
| 204 | ------------------------------------------------ |
| 205 | git stream tcp nowait nobody /usr/bin/git-daemon |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 206 | git-daemon --inetd --verbose --export-all |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 207 | /pub/foo /pub/bar |
| 208 | ------------------------------------------------ |
| 209 | |
| 210 | |
| 211 | git-daemon as inetd server for virtual hosts:: |
| 212 | To set up `git-daemon` as an inetd service that handles |
| 213 | repositories for different virtual hosts, `www.example.com` |
| 214 | and `www.example.org`, place an entry like the following into |
| 215 | `/etc/inetd` all on one line: |
| 216 | + |
| 217 | ------------------------------------------------ |
| 218 | git stream tcp nowait nobody /usr/bin/git-daemon |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame] | 219 | git-daemon --inetd --verbose --export-all |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 220 | --interpolated-path=/pub/%H%D |
| 221 | /pub/www.example.org/software |
| 222 | /pub/www.example.com/software |
| 223 | /software |
| 224 | ------------------------------------------------ |
| 225 | + |
| 226 | In this example, the root-level directory `/pub` will contain |
| 227 | a subdirectory for each virtual host name supported. |
| 228 | Further, both hosts advertise repositories simply as |
| 229 | `git://www.example.com/software/repo.git`. For pre-1.4.0 |
| 230 | clients, a symlink from `/software` into the appropriate |
| 231 | default repository could be made as well. |
| 232 | |
| 233 | |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 234 | git-daemon as regular daemon for virtual hosts:: |
| 235 | To set up `git-daemon` as a regular, non-inetd service that |
| 236 | handles repositories for multiple virtual hosts based on |
| 237 | their IP addresses, start the daemon like this: |
| 238 | + |
| 239 | ------------------------------------------------ |
| 240 | git-daemon --verbose --export-all |
| 241 | --interpolated-path=/pub/%IP/%D |
| 242 | /pub/192.168.1.200/software |
| 243 | /pub/10.10.220.23/software |
| 244 | ------------------------------------------------ |
| 245 | + |
| 246 | In this example, the root-level directory `/pub` will contain |
| 247 | a subdirectory for each virtual host IP address supported. |
| 248 | Repositories can still be accessed by hostname though, assuming |
| 249 | they correspond to these IP addresses. |
| 250 | |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 251 | selectively enable/disable services per repository:: |
| 252 | To enable `git-archive --remote` and disable `git-fetch` against |
| 253 | a repository, have the following in the configuration file in the |
| 254 | repository (that is the file 'config' next to 'HEAD', 'refs' and |
| 255 | 'objects'). |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 256 | + |
| 257 | ---------------------------------------------------------------- |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 258 | [daemon] |
| 259 | uploadpack = false |
| 260 | uploadarchive = true |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 261 | ---------------------------------------------------------------- |
| 262 | |
| 263 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 264 | Author |
| 265 | ------ |
| 266 | Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki |
| 267 | <yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org> |
| 268 | |
| 269 | Documentation |
| 270 | -------------- |
| 271 | Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. |
| 272 | |
| 273 | GIT |
| 274 | --- |
| 275 | Part of the gitlink:git[7] suite |