Skip to content

Instantly share code, notes, and snippets.

@NetOpWibby
Forked from jeremiah/git-daemon
Created January 29, 2020 07:59
Show Gist options
  • Save NetOpWibby/5b99ef83f108d7bbc610453cfd9ff38d to your computer and use it in GitHub Desktop.
Save NetOpWibby/5b99ef83f108d7bbc610453cfd9ff38d to your computer and use it in GitHub Desktop.
systemd-unit for git-daemon
# conf.d file for git-daemon
#
# Please check man 1 git-daemon for more information about the options
# git-daemon accepts. You MUST edit this to include your repositories you wish
# to serve.
#
# Some of the meaningful options are:
# --syslog --- Enables syslog logging
# --verbose --- Enables verbose logging
# --export-all --- Exports all repositories
# --port=XXXX --- Starts in port XXXX instead of 9418
#
GITDAEMON_OPTS="--syslog --base-path=/var/git"
# To run an anonymous git safely, the following user should be able to only
# read your Git repositories. It should not be able to write to anywhere on
# your system, esp. not the repositories.
GIT_USER="nobody"
GIT_GROUP="nobody"
[Unit]
Description=Git Activation Socket
[Socket]
ListenStream=9418
Accept=true
[Install]
WantedBy=sockets.target
[Unit]
Description=Git Repositories Server Daemon
Documentation=man:git-daemon(1)
[Service]
User=nobody
Group=nobody
EnvironmentFile=/etc/conf.d/git-daemon
# Ignore non-zero exit status, access error makes git-daemon return them
ExecStart=-/usr/libexec/git-core/git-daemon --inetd --base-path=/var/git --verbose $GITDAEMON_OPTS
StandardInput=socket
StandardOutput=inherit
StandardError=journal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment