Git protocol

From wikinotes

The simplest way of serving git, unauthenticated and read-only via the git-daemon.


WARNING:

Make sure to add the (empty) file git-daemon-export-ok to every repository that you want to allow git-daemon to access. Otherwise access denied.

NOTE:

If all you need is to export to github or something else, just replace the git history.
See git usage.

Documentation

man git-daemon https://man.archlinux.org/man/extra/git/git-daemon.1.en

Configuration

Enable GitDaemon

FreeBSD

echo "git_daemon_enable=\"YES\"" >> /etc/rc.conf
service git_daemon start

mkdir /usr/local/git
chown git:git /usr/local/git

Archlinux

sudo systemctl enable git-daemon
sudo systemctl start  git-daemon
mkdir /srv/git

Add Repo

Copy/Link repo to git-daemon's configured dir,
and add git-daemon-export-ok to mark it allowed for export.

ln -s /repos/${repo} /usr/local/git/${repo}
touch /usr/local/git/${repo}/git-daemon-export-ok

Pull From Repo

git clone git://${your_server}:9418/usr/local/git/repository.git