git daemon <directory...>

A really simple server for Git repositories

Arguments

NameDescription
directoryA directory to add to the whitelist of allowed directories. Unless --strict-paths is specified this will also include subdirectories of each named directory

Options

NameDescription
--strict-pathsMatch paths exactly (i.e. don’t allow "/foo/repo" when the real path is "/foo/repo.git" or "/foo/repo/.git") and don’t do user-relative paths. git daemon will refuse to start when this option is enabled and no whitelist is specified
--base-path <path>Remap all the path requests as relative to the given path
--base-path-relaxedIf --base-path is enabled and repo lookup fails, with this option git daemon will attempt to lookup without prefixing the base path. This is useful for switching to --base-path usage, while still allowing the old paths
--interpolated-path <path-template>To support virtual hosting, an interpolated path template can be used to dynamically construct alternate paths. The template supports %H for the target hostname as supplied by the client but converted to all lowercase, %CH for the canonical hostname, %IP for the server’s IP address, %P for the port number, and %D for the absolute path of the named repository. After interpolation, the path is validated against the directory whitelist
--export-allAllow pulling from all directories that look like Git repositories (have the objects and refs subdirectories), even if they do not have the git-daemon-export-ok file
--inetdHave the server run as an inetd service
--listen <host_or_ipaddr>Listen on a specific IP address or hostname. IP addresses can be either an IPv4 address or an IPv6 address if supported. If IPv6 is not supported, then --listen=hostname is also not supported and --listen must be given an IPv4 address. Can be given more than once. Incompatible with --inetd option
--port <port>Listen on an alternative port. Incompatible with --inetd option
--init-timeout <timeout>Timeout (in seconds) between the moment the connection is established and the client request is received (typically a rather low value, since that should be basically immediate)
--max-connections <maximum>Maximum number of concurrent clients, defaults to 32. Set it to zero for no limit
--syslogShort for --log-destination=syslog
--log-destination <destination>Send log messages to the specified destination. Note that this option does not imply --verbose, thus by default only error conditions will be logged. The default destination is syslog if --inetd or --detach is specified, otherwise stderr
--user-path <path>Allow ~user notation to be used in requests. When specified with no parameter, requests to git://host/~alice/foo is taken as a request to access foo repository in the home directory of user alice. If --user-path=some-path is specified, the same request is taken as a request to access the some-path/foo repository in the home directory of user alice
--verboseLog details about the incoming connections and requested files
--detachDetach from the shell. Implies --syslog
--pid-file <file>Save the process id in the provided file
--user <user>Change daemon’s uid and gid before entering the service loop. When only --user is given without --group, the primary group ID for the user is used. The values of the option are given to getpwnam(3) and getgrnam(3) and numeric IDs are not supported
--groupChange daemon’s gid before entering the service loop. The value of this option is given to getgrnam(3) and numeric IDs are not supported
--enable <service>Enable the service site-wide per default
--disable <service>Disable the service site-wide per default. Note that a service disabled site-wide can still be enabled per repository if it is marked overridable and the repository enables the service with a configuration item
--allow-override <service>Allow overriding the site-wide default with per repository configuration. By default, all the services may be overridden
--forbid-override <service>Forbid overriding the site-wide default with per repository configuration. By default, all the services may be overridden
--informative-errorsWhen informative errors are turned on, git-daemon will report more verbose errors to the client, differentiating conditions like "no such repository" from "repository not exported". This is more convenient for clients, but may leak information about the existence of unexported repositories. When informative errors are not enabled, all errors report "access denied" to the client
--no-informative-errorsTurn off informative errors. This option is the default. See --informative-errors for more information
--access-hook <path>Every time a client connects, first run an external command specified by the <path> with service name (e.g. "upload-pack"), path to the repository, hostname (%H), canonical hostname (%CH), IP address (%IP), and TCP port (%P) as its command-line arguments. The external command can decide to decline the service by exiting with a non-zero status (or to allow it by exiting with a zero status). It can also look at the $REMOTE_ADDR and $REMOTE_PORT environment variables to learn about the requestor when making this decision. The external command can optionally write a single line to its standard output to be sent to the requestor as an error message when it declines the service