git-daemon is an reciept of unit configuration to run git-daemon(1) on Debain-11
I forked this reciept of the unit configuration from @jeremiah and I adopted to run it in debian-11 systems.
In our Debian-11 systems, you must to do next steps to install git-daemon:
1st step. Create the user named 'git' along with its home directory /home/git and its shell /usr/bin/git-shell. Also, I recommend to create the subdirectory /home/git/repos/git-shell-commands in Git's home directory. You must to assign some permissions as below
sudo useradd -m -d /home/git -s /usr/bin/git-shell git &&
sudo -u git mkdir -m 755 -p /home/git/repos/git-shell-commands
2nd step. Verify git-daemon@.service to your local configuration. particularly this line; "ExecStart=-/usr/lib/git-core/git-daemon --inetd --base-path=/home/git/repos --verbose $GITDAEMON_OPTS"
3rd step. Move the git-daemon@.service template and git-daemon.socket files into /usr/lib/systemd/system/.
sudo systemctl enable /lib/systemd/system/git-daemon.socket sudo systemctl start git-daemon.socket
Notice: the conf.d file must be located must be located in there what path was indicated in the variable EnvironmentFile of the file git-daemon@.service. In debian, config files of system unit should placed in directory '/usr/lib/systemd/.d' where 'unit-service' means its name as like for git-daemon .
About git-daemon is a really simple server for Git repositories. This server listens on port "DEFAULT_GIT_PORT" aka 9418. It waits for a connection asking for a service, and will serve that service if it is enabled.