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 | |
| 40 | OPTIONS |
| 41 | ------- |
| 42 | --strict-paths:: |
| 43 | Match paths exactly (i.e. don't allow "/foo/repo" when the real path is |
| 44 | "/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths. |
| 45 | git-daemon will refuse to start when this option is enabled and no |
| 46 | whitelist is specified. |
| 47 | |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 48 | --base-path:: |
| 49 | Remap all the path requests as relative to the given path. |
| 50 | This is sort of "GIT root" - if you run git-daemon with |
| 51 | '--base-path=/srv/git' on example.com, then if you later try to pull |
| 52 | 'git://example.com/hello.git', `git-daemon` will interpret the path |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 53 | as '/srv/git/hello.git'. |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 54 | |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 55 | --interpolated-path=pathtemplate:: |
| 56 | To support virtual hosting, an interpolated path template can be |
| 57 | used to dynamically construct alternate paths. The template |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 58 | supports %H for the target hostname as supplied by the client but |
| 59 | converted to all lowercase, %CH for the canonical hostname, |
| 60 | %IP for the server's IP address, %P for the port number, |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 61 | and %D for the absolute path of the named repository. |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 62 | After interpolation, the path is validated against the directory |
| 63 | whitelist. |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 64 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 65 | --export-all:: |
| 66 | Allow pulling from all directories that look like GIT repositories |
| 67 | (have the 'objects' and 'refs' subdirectories), even if they |
| 68 | do not have the 'git-daemon-export-ok' file. |
| 69 | |
| 70 | --inetd:: |
| 71 | Have the server run as an inetd service. Implies --syslog. |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 72 | Incompatible with --port, --listen, --user and --group options. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 73 | |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 74 | --listen=host_or_ipaddr:: |
| 75 | Listen on an a specific IP address or hostname. IP addresses can |
| 76 | be either an IPv4 address or an IPV6 address if supported. If IPv6 |
| 77 | is not supported, then --listen=hostname is also not supported and |
| 78 | --listen must be given an IPv4 address. |
| 79 | Incompatible with '--inetd' option. |
| 80 | |
| 81 | --port=n:: |
| 82 | Listen on an alternative port. Incompatible with '--inetd' option. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 83 | |
| 84 | --init-timeout:: |
| 85 | Timeout between the moment the connection is established and the |
| 86 | client request is received (typically a rather low value, since |
| 87 | that should be basically immediate). |
| 88 | |
| 89 | --timeout:: |
| 90 | Timeout for specific client sub-requests. This includes the time |
| 91 | it takes for the server to process the sub-request and time spent |
| 92 | waiting for next client's request. |
| 93 | |
| 94 | --syslog:: |
| 95 | Log to syslog instead of stderr. Note that this option does not imply |
| 96 | --verbose, thus by default only error conditions will be logged. |
| 97 | |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 98 | --user-path, --user-path=path:: |
| 99 | Allow ~user notation to be used in requests. When |
| 100 | specified with no parameter, requests to |
| 101 | git://host/~alice/foo is taken as a request to access |
| 102 | 'foo' repository in the home directory of user `alice`. |
| 103 | If `--user-path=path` is specified, the same request is |
| 104 | taken as a request to access `path/foo` repository in |
| 105 | the home directory of user `alice`. |
| 106 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 107 | --verbose:: |
| 108 | Log details about the incoming connections and requested files. |
| 109 | |
Junio C Hamano | abb53dc | 2006-07-28 05:14:12 | [diff] [blame] | 110 | --reuseaddr:: |
| 111 | Use SO_REUSEADDR when binding the listening socket. |
| 112 | This allows the server to restart without waiting for |
| 113 | old connections to time out. |
| 114 | |
| 115 | --detach:: |
| 116 | Detach from the shell. Implies --syslog. |
| 117 | |
| 118 | --pid-file=file:: |
| 119 | Save the process id in 'file'. |
| 120 | |
Junio C Hamano | 9adfc6a | 2006-08-28 07:18:38 | [diff] [blame] | 121 | --user=user, --group=group:: |
| 122 | Change daemon's uid and gid before entering the service loop. |
| 123 | When only `--user` is given without `--group`, the |
| 124 | primary group ID for the user is used. The values of |
| 125 | the option are given to `getpwnam(3)` and `getgrnam(3)` |
| 126 | and numeric IDs are not supported. |
| 127 | + |
| 128 | Giving these options is an error when used with `--inetd`; use |
| 129 | the facility of inet daemon to achieve the same before spawning |
| 130 | `git-daemon` if needed. |
| 131 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 132 | --enable-service, --disable-service:: |
| 133 | Enable/disable the service site-wide per default. Note |
| 134 | that a service disabled site-wide can still be enabled |
| 135 | per repository if it is marked overridable and the |
| 136 | repository enables the service with an configuration |
| 137 | item. |
| 138 | |
| 139 | --allow-override, --forbid-override:: |
| 140 | Allow/forbid overriding the site-wide default with per |
| 141 | repository configuration. By default, all the services |
| 142 | are overridable. |
| 143 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 144 | <directory>:: |
| 145 | A directory to add to the whitelist of allowed directories. Unless |
| 146 | --strict-paths is specified this will also include subdirectories |
| 147 | of each named directory. |
| 148 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 149 | SERVICES |
| 150 | -------- |
| 151 | |
| 152 | upload-pack:: |
| 153 | This serves `git-fetch-pack` and `git-peek-remote` |
| 154 | clients. It is enabled by default, but a repository can |
| 155 | disable it by setting `daemon.uploadpack` configuration |
| 156 | item to `false`. |
| 157 | |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 158 | EXAMPLES |
| 159 | -------- |
| 160 | git-daemon as inetd server:: |
| 161 | To set up `git-daemon` as an inetd service that handles any |
| 162 | repository under the whitelisted set of directories, /pub/foo |
| 163 | and /pub/bar, place an entry like the following into |
| 164 | /etc/inetd all on one line: |
| 165 | + |
| 166 | ------------------------------------------------ |
| 167 | git stream tcp nowait nobody /usr/bin/git-daemon |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame^] | 168 | git-daemon --inetd --verbose --export-all |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 169 | /pub/foo /pub/bar |
| 170 | ------------------------------------------------ |
| 171 | |
| 172 | |
| 173 | git-daemon as inetd server for virtual hosts:: |
| 174 | To set up `git-daemon` as an inetd service that handles |
| 175 | repositories for different virtual hosts, `www.example.com` |
| 176 | and `www.example.org`, place an entry like the following into |
| 177 | `/etc/inetd` all on one line: |
| 178 | + |
| 179 | ------------------------------------------------ |
| 180 | git stream tcp nowait nobody /usr/bin/git-daemon |
Junio C Hamano | 29f1431 | 2006-10-26 08:47:29 | [diff] [blame^] | 181 | git-daemon --inetd --verbose --export-all |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 182 | --interpolated-path=/pub/%H%D |
| 183 | /pub/www.example.org/software |
| 184 | /pub/www.example.com/software |
| 185 | /software |
| 186 | ------------------------------------------------ |
| 187 | + |
| 188 | In this example, the root-level directory `/pub` will contain |
| 189 | a subdirectory for each virtual host name supported. |
| 190 | Further, both hosts advertise repositories simply as |
| 191 | `git://www.example.com/software/repo.git`. For pre-1.4.0 |
| 192 | clients, a symlink from `/software` into the appropriate |
| 193 | default repository could be made as well. |
| 194 | |
| 195 | |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 196 | git-daemon as regular daemon for virtual hosts:: |
| 197 | To set up `git-daemon` as a regular, non-inetd service that |
| 198 | handles repositories for multiple virtual hosts based on |
| 199 | their IP addresses, start the daemon like this: |
| 200 | + |
| 201 | ------------------------------------------------ |
| 202 | git-daemon --verbose --export-all |
| 203 | --interpolated-path=/pub/%IP/%D |
| 204 | /pub/192.168.1.200/software |
| 205 | /pub/10.10.220.23/software |
| 206 | ------------------------------------------------ |
| 207 | + |
| 208 | In this example, the root-level directory `/pub` will contain |
| 209 | a subdirectory for each virtual host IP address supported. |
| 210 | Repositories can still be accessed by hostname though, assuming |
| 211 | they correspond to these IP addresses. |
| 212 | |
| 213 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 214 | Author |
| 215 | ------ |
| 216 | Written by Linus Torvalds <torvalds@osdl.org>, YOSHIFUJI Hideaki |
| 217 | <yoshfuji@linux-ipv6.org> and the git-list <git@vger.kernel.org> |
| 218 | |
| 219 | Documentation |
| 220 | -------------- |
| 221 | Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. |
| 222 | |
| 223 | GIT |
| 224 | --- |
| 225 | Part of the gitlink:git[7] suite |
| 226 | |