legit: a simple git web frontend

published: 2024-03-16
tags: git software version-control

I program as a hobby, for fun. I mostly make random little things for myself and the odd thing for a friend. Sometimes I think that other people might find these useful so I wanted somewhere to put them up to share, self hosted of course.

I use fossil for my version control. I like it, been meaning to write about it and hopefully I will, separately from this. That's for another time though! Though I love it, I realise most people use git so I wanted to still provide an alternative interface for my repos and a way to git clone them.

Early on I used gitea and switched to forgejo when that fork came about. Given that I'm the only one using it, on top of the fact that I'm actually using fossil and simply mirroring that repo to git, it always felt like "too much" to me. I don't need something with a full interface designed around serving many users. Of course, forgejo isn't heavy to run at all or anything and I could easily carry on using it but I've always wanted something else.

I had looked at cgit which is closer to what I wanted but it's a CGI script. There's nothing wrong with that it's just that I use caddy and CGI isn't something that's natively supported and I don't really want to go messing with plugins. There are wrappers you can use so you can reverse proxy them but then I'd have multiple things running.

I happened to come across legit the other day and played around with it for a bit. Turns out it's exactly what I was looking for! There's not much to configure, mostly just pointing it to your directory containing your git repos. The main page is a simple list of repos and the last commit time with the actual repo pages themselves showing the last couple of commits with the readme underneath. There's some links at the top for looking at the file list, full commit history and branches. It doesn't do syntax highlighting but does highlight added/removed lines.

Small update: I've now also removed the flex grid repo list and replaced it with simple rows.

I have an instance running at right now. One small thing that I wasn't keen on though, was the default template. It's very bright!

I spent a little while editing it to look more like my site theme and made a couple of adjustments to the sizing of the columns on the repo index page since I noticed the repo name tended to end up on two lines a lot. I also removed the email displaying on every commit, it's mostly pointless for me since I'm the only one using it. You can find the theme here if you'd like to build off of it.