LinuxCommandLibrary

git-daemon

Simple Git protocol server for repository access

TLDR

Start Git daemon

$ git daemon --base-path=[/path/to/repos]
copy
Enable upload-pack
$ git daemon --enable=upload-pack --base-path=[/repos]
copy
Allow push
$ git daemon --enable=receive-pack --base-path=[/repos]
copy
Run in foreground
$ git daemon --verbose --base-path=[/repos]
copy
Export all directories
$ git daemon --export-all --base-path=[/repos]
copy

SYNOPSIS

git daemon [options] [directory...]

DESCRIPTION

git daemon provides a simple, lightweight server for Git repositories using the git:// protocol. It enables anonymous read access to repositories by default, with optional write access when explicitly enabled, making it suitable for public repository hosting and internal network sharing.
The daemon listens on port 9418 by default and serves repositories from a specified base path. Unlike HTTP-based Git servers, git daemon requires no web server setup, offering minimal overhead for read-only repository access.
Security is intentionally limited: repositories must be explicitly exported (via --export-all or git-daemon-export-ok file), and write access should only be enabled in trusted environments. For production systems requiring authentication and encryption, HTTPS or SSH protocols are recommended instead.

PARAMETERS

--base-path path

Base path for repositories.
--export-all
Export all repositories.
--enable service
Enable service.
--disable service
Disable service.
--port port
Listen port (default 9418).
--listen host
Listen address.
--verbose
Log details.
--inetd
Run from inetd.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community