Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-daemon(1) |
| 2 | ============= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [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 | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 11 | 'git daemon' [--verbose] [--syslog] [--export-all] |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 12 | [--timeout=<n>] [--init-timeout=<n>] [--max-connections=<n>] |
| 13 | [--strict-paths] [--base-path=<path>] [--base-path-relaxed] |
| 14 | [--user-path | --user-path=<path>] |
| 15 | [--interpolated-path=<pathtemplate>] |
| 16 | [--reuseaddr] [--detach] [--pid-file=<file>] |
| 17 | [--enable=<service>] [--disable=<service>] |
| 18 | [--allow-override=<service>] [--forbid-override=<service>] |
Junio C Hamano | 3d1b5a1 | 2013-05-17 23:34:02 | [diff] [blame] | 19 | [--access-hook=<path>] [--[no-]informative-errors] |
| 20 | [--inetd | |
| 21 | [--listen=<host_or_ipaddr>] [--port=<n>] |
| 22 | [--user=<user> [--group=<group>]]] |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 23 | [<directory>...] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 24 | |
| 25 | DESCRIPTION |
| 26 | ----------- |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 27 | 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] | 28 | aka 9418. It waits for a connection asking for a service, and will serve |
| 29 | that service if it is enabled. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 30 | |
| 31 | It verifies that the directory has the magic file "git-daemon-export-ok", and |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 32 | it will refuse to export any Git directory that hasn't explicitly been marked |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 33 | for export this way (unless the '--export-all' parameter is specified). If you |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 34 | pass some directory paths as 'git daemon' arguments, you can further restrict |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 35 | the offers to a whitelist comprising of those. |
| 36 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 37 | By default, only `upload-pack` service is enabled, which serves |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 38 | 'git fetch-pack' and 'git ls-remote' clients, which are invoked |
| 39 | from 'git fetch', 'git pull', and 'git clone'. |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 40 | |
| 41 | This is ideally suited for read-only updates, i.e., pulling from |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 42 | Git repositories. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 43 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 44 | An `upload-archive` also exists to serve 'git archive'. |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 45 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 46 | OPTIONS |
| 47 | ------- |
| 48 | --strict-paths:: |
| 49 | Match paths exactly (i.e. don't allow "/foo/repo" when the real path is |
| 50 | "/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 51 | 'git daemon' will refuse to start when this option is enabled and no |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 52 | whitelist is specified. |
| 53 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 54 | --base-path=<path>:: |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 55 | Remap all the path requests as relative to the given path. |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 56 | This is sort of "Git root" - if you run 'git daemon' with |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 57 | '--base-path=/srv/git' on example.com, then if you later try to pull |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 58 | 'git://example.com/hello.git', 'git daemon' will interpret the path |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 59 | as '/srv/git/hello.git'. |
Junio C Hamano | 4d04a40 | 2006-01-09 00:53:28 | [diff] [blame] | 60 | |
Junio C Hamano | 0ddc94d | 2007-08-01 08:42:39 | [diff] [blame] | 61 | --base-path-relaxed:: |
| 62 | If --base-path is enabled and repo lookup fails, with this option |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 63 | 'git daemon' will attempt to lookup without prefixing the base path. |
Junio C Hamano | 0ddc94d | 2007-08-01 08:42:39 | [diff] [blame] | 64 | This is useful for switching to --base-path usage, while still |
| 65 | allowing the old paths. |
| 66 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 67 | --interpolated-path=<pathtemplate>:: |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 68 | To support virtual hosting, an interpolated path template can be |
| 69 | used to dynamically construct alternate paths. The template |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 70 | supports %H for the target hostname as supplied by the client but |
| 71 | converted to all lowercase, %CH for the canonical hostname, |
| 72 | %IP for the server's IP address, %P for the port number, |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 73 | and %D for the absolute path of the named repository. |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 74 | After interpolation, the path is validated against the directory |
| 75 | whitelist. |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 76 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 77 | --export-all:: |
Junio C Hamano | 076ffcc | 2013-02-06 05:13:21 | [diff] [blame] | 78 | Allow pulling from all directories that look like Git repositories |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 79 | (have the 'objects' and 'refs' subdirectories), even if they |
| 80 | do not have the 'git-daemon-export-ok' file. |
| 81 | |
| 82 | --inetd:: |
| 83 | Have the server run as an inetd service. Implies --syslog. |
Junio C Hamano | 97bcb48 | 2010-11-25 03:16:07 | [diff] [blame] | 84 | Incompatible with --detach, --port, --listen, --user and --group |
| 85 | options. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 86 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 87 | --listen=<host_or_ipaddr>:: |
Junio C Hamano | 4cfa536 | 2009-04-18 23:01:01 | [diff] [blame] | 88 | Listen on a specific IP address or hostname. IP addresses can |
| 89 | be either an IPv4 address or an IPv6 address if supported. If IPv6 |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 90 | is not supported, then --listen=hostname is also not supported and |
| 91 | --listen must be given an IPv4 address. |
Junio C Hamano | 39c7a69 | 2010-10-27 06:08:54 | [diff] [blame] | 92 | Can be given more than once. |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 93 | Incompatible with '--inetd' option. |
| 94 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 95 | --port=<n>:: |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 96 | Listen on an alternative port. Incompatible with '--inetd' option. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 97 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 98 | --init-timeout=<n>:: |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 99 | Timeout (in seconds) between the moment the connection is established |
| 100 | and the client request is received (typically a rather low value, since |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 101 | that should be basically immediate). |
| 102 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 103 | --timeout=<n>:: |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 104 | Timeout (in seconds) for specific client sub-requests. This includes |
| 105 | the time it takes for the server to process the sub-request and the |
| 106 | time spent waiting for the next client's request. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 107 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 108 | --max-connections=<n>:: |
Junio C Hamano | fcb740a | 2008-08-31 06:32:05 | [diff] [blame] | 109 | Maximum number of concurrent clients, defaults to 32. Set it to |
| 110 | zero for no limit. |
| 111 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 112 | --syslog:: |
| 113 | Log to syslog instead of stderr. Note that this option does not imply |
| 114 | --verbose, thus by default only error conditions will be logged. |
| 115 | |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 116 | --user-path:: |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 117 | --user-path=<path>:: |
Junio C Hamano | 116db35 | 2008-12-17 19:48:40 | [diff] [blame] | 118 | Allow {tilde}user notation to be used in requests. When |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 119 | specified with no parameter, requests to |
Junio C Hamano | 116db35 | 2008-12-17 19:48:40 | [diff] [blame] | 120 | git://host/{tilde}alice/foo is taken as a request to access |
Junio C Hamano | 70fafca | 2006-02-06 08:02:01 | [diff] [blame] | 121 | 'foo' repository in the home directory of user `alice`. |
| 122 | If `--user-path=path` is specified, the same request is |
| 123 | taken as a request to access `path/foo` repository in |
| 124 | the home directory of user `alice`. |
| 125 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 126 | --verbose:: |
| 127 | Log details about the incoming connections and requested files. |
| 128 | |
Junio C Hamano | abb53dc | 2006-07-28 05:14:12 | [diff] [blame] | 129 | --reuseaddr:: |
| 130 | Use SO_REUSEADDR when binding the listening socket. |
| 131 | This allows the server to restart without waiting for |
| 132 | old connections to time out. |
| 133 | |
| 134 | --detach:: |
| 135 | Detach from the shell. Implies --syslog. |
| 136 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 137 | --pid-file=<file>:: |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 138 | Save the process id in 'file'. Ignored when the daemon |
| 139 | is run under `--inetd`. |
Junio C Hamano | abb53dc | 2006-07-28 05:14:12 | [diff] [blame] | 140 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 141 | --user=<user>:: |
| 142 | --group=<group>:: |
Junio C Hamano | 9adfc6a | 2006-08-28 07:18:38 | [diff] [blame] | 143 | Change daemon's uid and gid before entering the service loop. |
| 144 | When only `--user` is given without `--group`, the |
| 145 | primary group ID for the user is used. The values of |
| 146 | the option are given to `getpwnam(3)` and `getgrnam(3)` |
| 147 | and numeric IDs are not supported. |
| 148 | + |
| 149 | Giving these options is an error when used with `--inetd`; use |
| 150 | the facility of inet daemon to achieve the same before spawning |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 151 | 'git daemon' if needed. |
Junio C Hamano | ea3b752 | 2013-04-18 19:37:53 | [diff] [blame] | 152 | + |
| 153 | Like many programs that switch user id, the daemon does not reset |
| 154 | environment variables such as `$HOME` when it runs git programs, |
| 155 | e.g. `upload-pack` and `receive-pack`. When using this option, you |
| 156 | may also want to set and export `HOME` to point at the home |
| 157 | directory of `<user>` before starting the daemon, and make sure any |
| 158 | Git configuration files in that directory are readable by `<user>`. |
Junio C Hamano | 9adfc6a | 2006-08-28 07:18:38 | [diff] [blame] | 159 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 160 | --enable=<service>:: |
| 161 | --disable=<service>:: |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 162 | Enable/disable the service site-wide per default. Note |
| 163 | that a service disabled site-wide can still be enabled |
| 164 | per repository if it is marked overridable and the |
Junio C Hamano | 4cfa536 | 2009-04-18 23:01:01 | [diff] [blame] | 165 | repository enables the service with a configuration |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 166 | item. |
| 167 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 168 | --allow-override=<service>:: |
| 169 | --forbid-override=<service>:: |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 170 | Allow/forbid overriding the site-wide default with per |
| 171 | repository configuration. By default, all the services |
Junio C Hamano | e1aeb5e | 2014-06-06 19:16:29 | [diff] [blame] | 172 | may be overridden. |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 173 | |
Junio C Hamano | 3d1b5a1 | 2013-05-17 23:34:02 | [diff] [blame] | 174 | --[no-]informative-errors:: |
Junio C Hamano | 6231f82 | 2011-10-24 05:18:52 | [diff] [blame] | 175 | When informative errors are turned on, git-daemon will report |
| 176 | more verbose errors to the client, differentiating conditions |
| 177 | like "no such repository" from "repository not exported". This |
| 178 | is more convenient for clients, but may leak information about |
| 179 | the existence of unexported repositories. When informative |
| 180 | errors are not enabled, all errors report "access denied" to the |
| 181 | client. The default is --no-informative-errors. |
| 182 | |
Junio C Hamano | f335393 | 2012-09-04 23:16:51 | [diff] [blame] | 183 | --access-hook=<path>:: |
| 184 | Every time a client connects, first run an external command |
| 185 | specified by the <path> with service name (e.g. "upload-pack"), |
| 186 | path to the repository, hostname (%H), canonical hostname |
Junio C Hamano | e1aeb5e | 2014-06-06 19:16:29 | [diff] [blame] | 187 | (%CH), IP address (%IP), and TCP port (%P) as its command-line |
Junio C Hamano | f335393 | 2012-09-04 23:16:51 | [diff] [blame] | 188 | arguments. The external command can decide to decline the |
| 189 | service by exiting with a non-zero status (or to allow it by |
| 190 | exiting with a zero status). It can also look at the $REMOTE_ADDR |
| 191 | and $REMOTE_PORT environment variables to learn about the |
| 192 | requestor when making this decision. |
| 193 | + |
| 194 | The external command can optionally write a single line to its |
| 195 | standard output to be sent to the requestor as an error message when |
| 196 | it declines the service. |
| 197 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 198 | <directory>:: |
| 199 | A directory to add to the whitelist of allowed directories. Unless |
| 200 | --strict-paths is specified this will also include subdirectories |
| 201 | of each named directory. |
| 202 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 203 | SERVICES |
| 204 | -------- |
| 205 | |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 206 | These services can be globally enabled/disabled using the |
Junio C Hamano | e1aeb5e | 2014-06-06 19:16:29 | [diff] [blame] | 207 | command-line options of this command. If finer-grained |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 208 | control is desired (e.g. to allow 'git archive' to be run |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 209 | against only in a few selected repositories the daemon serves), |
| 210 | the per-repository configuration file can be used to enable or |
| 211 | disable them. |
| 212 | |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 213 | upload-pack:: |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 214 | This serves 'git fetch-pack' and 'git ls-remote' |
Junio C Hamano | 19ed368 | 2006-09-07 11:44:08 | [diff] [blame] | 215 | clients. It is enabled by default, but a repository can |
| 216 | disable it by setting `daemon.uploadpack` configuration |
| 217 | item to `false`. |
| 218 | |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 219 | upload-archive:: |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 220 | This serves 'git archive --remote'. It is disabled by |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 221 | default, but a repository can enable it by setting |
Junio C Hamano | feeb1be | 2008-05-22 00:53:35 | [diff] [blame] | 222 | `daemon.uploadarch` configuration item to `true`. |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 223 | |
| 224 | receive-pack:: |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 225 | This serves 'git send-pack' clients, allowing anonymous |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 226 | push. It is disabled by default, as there is _no_ |
| 227 | authentication in the protocol (in other words, anybody |
| 228 | can push anything into the repository, including removal |
| 229 | of refs). This is solely meant for a closed LAN setting |
| 230 | where everybody is friendly. This service can be |
Junio C Hamano | bb30064 | 2012-07-22 21:09:14 | [diff] [blame] | 231 | enabled by setting `daemon.receivepack` configuration item to |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 232 | `true`. |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 233 | |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 234 | EXAMPLES |
| 235 | -------- |
Junio C Hamano | a053d54 | 2006-10-27 09:29:13 | [diff] [blame] | 236 | We assume the following in /etc/services:: |
| 237 | + |
| 238 | ------------ |
| 239 | $ grep 9418 /etc/services |
| 240 | git 9418/tcp # Git Version Control System |
| 241 | ------------ |
| 242 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 243 | 'git daemon' as inetd server:: |
| 244 | To set up 'git daemon' as an inetd service that handles any |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 245 | repository under the whitelisted set of directories, /pub/foo |
| 246 | and /pub/bar, place an entry like the following into |
| 247 | /etc/inetd all on one line: |
| 248 | + |
| 249 | ------------------------------------------------ |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 250 | git stream tcp nowait nobody /usr/bin/git |
| 251 | git daemon --inetd --verbose --export-all |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 252 | /pub/foo /pub/bar |
| 253 | ------------------------------------------------ |
| 254 | |
| 255 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 256 | 'git daemon' as inetd server for virtual hosts:: |
| 257 | To set up 'git daemon' as an inetd service that handles |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 258 | repositories for different virtual hosts, `www.example.com` |
| 259 | and `www.example.org`, place an entry like the following into |
| 260 | `/etc/inetd` all on one line: |
| 261 | + |
| 262 | ------------------------------------------------ |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 263 | git stream tcp nowait nobody /usr/bin/git |
| 264 | git daemon --inetd --verbose --export-all |
Junio C Hamano | 47c1e3c | 2006-09-25 04:45:55 | [diff] [blame] | 265 | --interpolated-path=/pub/%H%D |
| 266 | /pub/www.example.org/software |
| 267 | /pub/www.example.com/software |
| 268 | /software |
| 269 | ------------------------------------------------ |
| 270 | + |
| 271 | In this example, the root-level directory `/pub` will contain |
| 272 | a subdirectory for each virtual host name supported. |
| 273 | Further, both hosts advertise repositories simply as |
| 274 | `git://www.example.com/software/repo.git`. For pre-1.4.0 |
| 275 | clients, a symlink from `/software` into the appropriate |
| 276 | default repository could be made as well. |
| 277 | |
| 278 | |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 279 | 'git daemon' as regular daemon for virtual hosts:: |
| 280 | To set up 'git daemon' as a regular, non-inetd service that |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 281 | handles repositories for multiple virtual hosts based on |
| 282 | their IP addresses, start the daemon like this: |
| 283 | + |
| 284 | ------------------------------------------------ |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 285 | git daemon --verbose --export-all |
Junio C Hamano | 032c631 | 2006-09-28 07:39:18 | [diff] [blame] | 286 | --interpolated-path=/pub/%IP/%D |
| 287 | /pub/192.168.1.200/software |
| 288 | /pub/10.10.220.23/software |
| 289 | ------------------------------------------------ |
| 290 | + |
| 291 | In this example, the root-level directory `/pub` will contain |
| 292 | a subdirectory for each virtual host IP address supported. |
| 293 | Repositories can still be accessed by hostname though, assuming |
| 294 | they correspond to these IP addresses. |
| 295 | |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 296 | selectively enable/disable services per repository:: |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 297 | To enable 'git archive --remote' and disable 'git fetch' against |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 298 | a repository, have the following in the configuration file in the |
| 299 | repository (that is the file 'config' next to 'HEAD', 'refs' and |
| 300 | 'objects'). |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 301 | + |
| 302 | ---------------------------------------------------------------- |
Junio C Hamano | dbb6459 | 2007-09-01 11:17:39 | [diff] [blame] | 303 | [daemon] |
| 304 | uploadpack = false |
Junio C Hamano | feeb1be | 2008-05-22 00:53:35 | [diff] [blame] | 305 | uploadarch = true |
Junio C Hamano | 21e7f9c | 2007-08-31 07:56:26 | [diff] [blame] | 306 | ---------------------------------------------------------------- |
| 307 | |
| 308 | |
Junio C Hamano | 61b1229 | 2008-10-27 02:59:10 | [diff] [blame] | 309 | ENVIRONMENT |
| 310 | ----------- |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 311 | 'git daemon' will set REMOTE_ADDR to the IP address of the client |
Junio C Hamano | 61b1229 | 2008-10-27 02:59:10 | [diff] [blame] | 312 | that connected to it, if the IP address is available. REMOTE_ADDR will |
| 313 | be available in the environment of hooks called when |
| 314 | services are performed. |
| 315 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 316 | GIT |
| 317 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 318 | Part of the linkgit:git[1] suite |