]>
| description | Configurations and scripts for my self-hosted git server. |
| last change | Sun, 27 Sep 2026 03:58:24 +0000 (20:58 -0700) |
| URL | https://git.ardis.lu/git.ardis.lu.git |
| ssh://git@git.ardis.lu/~/git.ardis.lu.git | |
| git@git.ardis.lu:git.ardis.lu.git |
Configurations and scripts for my self-hosted git server.
Tested and running on Debian but these directions should work on any similar systemd distribution.
Code repository mirrors: GitHub, Codeberg, git.ardis.lu
sudo apt install git gitweb highlight ufw fcgiwrap
See Caddy: Install for directions on installing caddy.
See Comrak for installing comrak.
Explanation:
git is naturally required.gitweb is the chosen web frontend for maximum simplicity.highlight for code syntax highlighting on the web view.ufw for setting up firewall rules.fcgiwrap to call the gitweb and git-http-backend FastCGI scripts.caddy for the web server to serve the web view and repos over HTTPS.comrak for rendering README.md as close to GitHub as possible.Clone this repo somewhere on the server.
Update ./srv/git/.ssh/authorized_keys to include all admin SSH keys that should have write access to repos.
Run setup.sh to create or update the git user, git scripts, the git repo directory /srv/git, and gitweb configurations:
sudo ./setup.sh
sudo ufw allow "WWW Secure"
sudo ufw allow 443/udp
Browse existing repos using the web view: https://git.ardis.lu
Support for read/write:
| Transport protocol | Read | Write | Authorization required? |
|---|---|---|---|
ssh:// |
Yes | Yes | Yes |
https:// |
Yes | No | No |
http:// |
No | No | N/A |
git:// |
No | No | N/A |
http:// and git:// are disabled because (1) it simplifies server administration and (2) the lack of integrity checks or encryption makes them subject to tampering. This configuration matches GitHub's.
URLs to clone individual repos can be found within the repo page on the web view.
A minimal set of administrative commands.
initCreate a new repo and optionally set its description for the web view.
Single quote characters (') MUST be escaped using a backslash.
ssh git@git.ardis.lu init <repository_name> [repository_description]
rmDelete a repo.
ssh git@git.ardis.lu rm <repository_name>
To reverse the steps in setup.sh.
rm helper script to delete all repos:ssh git@git.ardis.lu rm <repository_name>
git user and its home directory /srv/git:sudo deluser --remove-home git
git-shell from /etc/shells:sudo vim /etc/shells
git-daemonThese steps are for reference only, they are not needed because git-daemon is not enabled on the server.
ufw rule to open port 9418 for git-daemon:sudo ufw delete limit 9418/tcp
git-daemon.service:sudo systemctl stop git-daemon
sudo systemctl disable git-daemon
sudo rm /etc/systemd/system/git-daemon.service
sudo systemctl daemon-reload
sudo systemctl reset-failed
| 3 weeks ago | main | shortlog | log | tree |