support and follow me on Mastodon and Twitter

Tested on OpenBSD 6.3 with git-2.16.2

Host Git repositories on OpenBSD

Deploy a server and login into it.

Install git(1):

# pkg_add git
git-2.16.2: ok
The following new rcscripts were installed: /etc/rc.d/gitdaemon
See rcctl(8) for details.
Look in /usr/local/share/doc/pkg-readmes for extra documentation.

Add git user:

# mkdir /home/git
# user add git

Add your public SSH key:

# mkdir -m 700 /home/git/.ssh
# cp /root/.ssh/authorized_keys /home/git/.ssh/

Set the proper owner and group, then exit.

# chown -R git:git /home/git

On the local host

Initialize bare repository on the remote:

$ ssh git@REMOTE git init --bare REPOSITORY.git
Initialized emtpy Git repository in /home/git/REPOSITORY.git/

Add the remote and push a local copy to it:

$ git remote add REMOTE git@REMOTE_SERVER:REPOSITORY.git
$ git push REMOTE master
Counting objects: 1049, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1041/1041), done.
Writing objects: 100% (1049/1049), 3.80 MiB | 257.00 KiB/s, done.
Total 1049 (delta 676), reused 0 (delta 0)
remote: Resolving deltas: 100% (676/676), done.
 * [new branch]      master -> master

Publish Git repositories.

Thanks to Luclu7_ for catching typos.