After a lot of work, I was finally able to set up a git server for my Raspberry
Pi 4, which is runing KISS. The server uses git
daemon
to serve repositories, and stagit
for the front end.
This project is based on git-bruh's post, all I've done is make it work on a Raspberry Pi, and packaged the required programs.
To start off, make sure you have git
installed.
After that, we can move onto installing stagit
, all the requirements are
provided by kiss-community, I
repackaged chroma-bin
to pull an aarch64
binary instead of amd64
. I also
added the helper scripts from git-bruh's post so you don't have to rewrite
them.
Once stagit
is installed, you need to add the git user.
$ adduser git
You can then send the server your keys from your machines.
$ ssh-copy-id git@server.com
You can read up more on setting up the ssh keys here
We're almost done, install the git-daemon-sv
package and enable it. git
daemon
uses port 9418
by default, so make sure you have it port forwarded.
Took me a long time to figure that one out.
Finally, set up your web server. I use a caddy config that looks similar to:
git.server.com {
root * /var/www/git
file_server
}
Now that git daemon
and stagit
are set up, it's time to create our first
repository!
$ su git
$ stagit-new-repo repo-name 'description'
# On the dev machine:
$ git clone git@server.com:repo-name
$ cd repo-name; echo "# Repo" > README.md
$ git add .; git commit -m "Initial commit!"
$ git push
css for stagit
can be generated using chroma
.
$ chroma --list styles # show the availabe styles.
$ . /etc/stagit/stagit.conf
$ chroma --html-styles --style=emacs > "$WWW_HOME/style.css"
When creating a new repository, run stagit-gen-index
AFTER your first
commit. You also run it after deleting a repository.
TIP: changing the description or the owner of a repository can be done by editing the respective files in the bare repository.
$ cd ~/repo-name.git
$ echo 'New Description' > description
$ echo 'New Owner' > owner
$ /etc/stagit/post-recieve # Update stagit
There you go, a suckless git server. See mine here