Roman's avatar

Hi, my name is Roman. I run a job board and make tutorials for BSD users. I'm fan of OpenBSD, POSIX-shell, and vi.

Twitter - RSS - Patreon - PayPal


Host your Git repositories

Deploy OpenBSD server on Vultr and login into it.

On the remote host

Install git(1):

# pkg_add install git
quirks-2.414 signed on 2018-03-28T14:24:37Z
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 keys:

# 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:

$ cd REPOSITORY
$ 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.
To REMOTE_SERVER:REPOSITORY.git
 * [new branch]      master -> master
$

Done! Now you may want to publish your Git repositories on the web.

Tested on OpenBSD 6.3 with git-2.16.2