git-daemon - Linux


git-daemon is a network service that allows users to access and interact with a Git repository over a network connection using the Git protocol. It provides an efficient and secure way to host and share Git repositories, enabling remote collaboration and access to shared code.


git daemon --port=<port> --export-all=<true/false> --verbose=<true/false> --listen=<host> --enable=<url-list> --disable=<url-list> --info-refs=<file>


  • –port: Specifies the network port on which the Git daemon listens for incoming connections.
  • –export-all: Determines whether all refs should be exported or only those that are reachable from the default branch.
  • –verbose: Controls the verbosity level of the Git daemon’s output.
  • –listen: Specifies the server’s host interface on which the daemon listens for connections.
  • –enable: Enables access to the specified URL(s) or patterns (e.g., –enable=*).
  • –disable: Disables access to the specified URL(s) or patterns (e.g., –disable=*).
  • –info-refs: Specifies a file containing custom information references to be exported by git-daemon.


Basic usage:

git daemon --port=9418

Exporting all refs:

git daemon --export-all=true --port=9418

Limiting access to specific URLs:

git daemon --enable=* --disable=*

Common Issues

  • Permission errors: Ensure the user running git-daemon has the necessary read/write permissions to the Git repository.
  • Port conflicts: Check if the specified port is already in use by another application.
  • Firewall blocking: Ensure the configured port is open in the system’s firewall.


git-daemon can be integrated with other tools to enhance its functionality:

  • Apache2: Use mod_dav_svn module to integrate git-daemon with Apache2 for HTTP-based access.
  • tunnels: Securely tunnel Git traffic over SSH using tools like ssh, stunnel, or socat.

Related Commands

  • git: The primary command-line tool for interacting with Git repositories.
  • git-upload-pack: Used to transfer data to a client for a fetch.
  • git-receive-pack: Used to transfer data from a client for a push.