Showcasing my Git repositories on the web
I took a fancy to the idea of hosting my own Git repositories. I did not want to simply mirror them elsewhere on someone else’s platform, but wanted them entirely under my control. I also wanted the repositories viewable in a way that feels familiar, like on GitHub or Codeberg. The problem is that most of the self-hosted solutions assume a certain level of server access and resources. On a shared host, that assumption falls down flat extremely quickly.
Dynamic Git web front-ends are clever pieces of software, but they come with a cost. They expect CGI or PHP support, fast disk access, and enough CPU and memory to regenerate views on demand. Whilst that might be perfectly fine on a VPS, it’s not going to happen on a shared host, as I proved to myself recently with CGI-git. After much playing around, it became obvious that the most viable solution was to have the Git web as a static site.
Because everything is generated ahead of time, there is no pressure on the server when someone clicks around. All the heavy lifting happens during the site generation, and the output can then be uploaded in much the same way as say, a blog, via FTP, Rsync or whatever.
There is also something quietly satisfying about this approach, as it strips Git web hosting back to the basics. My repositories are on my local disk, I have a generator script that understands them and which delivers static files out at the other end. There are no databases, no background daemons, no moving parts that can break because my shared hosting provider updated PHP or disabled a module overnight. Been there, done that! And, being non-dynamic on a shared host with limited resources, there should be no complaints from the neighbours.
I’ve mulled over displaying the file contents in the browser, as is customary with Git web applications. Maybe one day soon I’ll implement this, but for now, if anyone is really curious, there is always git clone to view the project files on your own machine.
GitGen came into existence to demonstrate (to myself) that self-hosting Git web repositories doesn’t have to mean running complex infrastructure. Even with very limited resources, it is very much possible to showcase one’s repositories in a lean, clean, navigable way that is pleasant to browse and easy to maintain.
It is a reminder that there is always another way to do things: simpler, quieter, and entirely under my control. KISS.
