Home | Text-Only | gopher:// | gemini://

No More GitHub - I Built My Own Git Server

2023-05-11 - [52] 2:22

This post is probably going to seem a little rambly... my apologies for that. Basically, I just wanted to be able to get out the fact that I built a git server, learned quite a bit in the experience, and am quite please with this setup.

Housekeeping and Quick Updates

As frequently seems to be the case at the beginning of these blog posts, I'm going to mention a few things unrelated to the actual post. The post will be back on subject at the "I Built My Own Git Server" header.

Website Design Change

You might have noticed that the design of my website (HTTP) has changed a bit. I needed to do a little bit of styling anyways, so I decided to get rid of all of the Javascript that the site was using. Also decided to add a "portrait" of myself on the home page and change up the navigation bar a tiny bit.

Finger Log

I added an archive page of the posts I write and distribute over the finger protocol. The Finger Log can be found at the link below.

My Finger Log

Ducks

I have also come into posession of some rubber ducks. These might be the only 2 that come into my posession or I might be stuck with more over time... a picture of the rubber ducks can be seen below.


I Built My Own Git Server

Before mentioning much, this post won't really go into the technical details of HOW I built the Git Server. Maybe in the future. You can see the progress of my work in building my git server at the following link.

My Git Repositories

Over the last few years, I have wanted to be in more control of my own things. This last year, I decided to do something about that and have been building a lot of my own tooling, especially my web server. The tools I build only need to work for me, so I didn't need to implement essentially any of the features GitHub provides. The ability for users to pull repos from my server using a git client is technically all I needed to implement, even if I did implement a bit more than that. The most important part was that the server needs to work with very little in terms of memory and storage resources. Building my own seemed like the best option, even if I wanted to build my own anyways, because quite a few options that I could have used are very resource heavy, especially for memory usage.

First, I got pushing over ssh working. That was the easiest part, as I already have a lot of experience setting up users (in this case I just needed to make a user named "git") and ssh. Next, I needed to set up bare repositories that were controlled by that "git" user and push the code from my GitHub repos to my server. Getting pulling over git:// working ended up being a little easier than I expected, but getting things set up to that point didn't allow anyone to browse my git repos without pulling to their machine...

Letting Users Browse My Git Repositories

Anyone who has used GitHub is likely familiar with the fact that GitHub makes it easy to browse through git commits and files. This allows users to see code before taking the plunge and cloning the git repo. Having an interface people could browse would be helpful for me, so I decided to make a simple git browsing static site generator, which I call "muninn".

Muninn means "Memory" and is one of Odin's ravens in Norse mythology. Considering git is a way to track code changes, which can be seen as "code memories", I felt the name was fitting. You can check out muninn in the link below.

Muninn (Git Repository)

Muninn was heavily inspired by Stagit, another static site generator for browsing git repositories, and the git browsing system used by the Suckless team. You can see a link to stagit in action below.

[HTTPS] Stagit being used for the Suckless's git repository viewer

The benefit of using something simple like this is that I can build it to work over HTTP, Gemini, and Gopher, with relatively minimal complications. I had to change up the code of my server to allow overlapping html and gmi files, but that wasn't all that much work.

Initially, I didn't want to bother with the HTTPS Smart Protocol for people to fetch repos over HTTPS, but then I figured out that it essentially required for the go tools to be able to fetch my repos. That took a frustrating amount of nginx configuration magic... After getting HTTPS git fetch requests working, the go tools STILL didn't want to work... Turns out I needed to add custom <meta> tags... For instance, my git repo "datecalc-go", which can be found at vigrey.com/git/datecalc-go, has the meta tag <meta name="go-import" content="vigrey.com/git/datecalc-go git https://vigrey.com/git/datecalc-go.git">.

When everything was comfortably hosted on my own server, I got rid of GitHub.

Why Get Rid of GitHub?

I'm a bit conflicted about this point... I honestly think that Microsoft has done a lot of great work on GitHub since acquiring them. With that said, I'm incredibly uncomfortable with Copilot. I won't go into details about that here, but do know that GitHub pushing Copilot hard is one of the reason why I wanted to leave GitHub, even if it took a lot of work to get there.

A big point for me though is that GitHub takes something that's built to be decentralized, git, and centralizes it. That sort of centralization can cause issues, especially when people feel like they don't need to make backups because "GitHub hosts my code and GitHub isn't going away anytime soon". I don't remember when between 2017 and 2021 this happened, but I specifically remember an Iranian citizen losing access to their git repos hosted on GitHub do to sanctions the US put in place. While I believe GitHub eventually allowed that user to fetch the git repos later on, the fact that a giant is in full control of the code others write and can restrict access in an unforseen instance is unfortunate and something I'd like to avoid in the first place.

How I Feel About It All

It was a lot of work to get to this point. I had to learn a lot about git and even had to learn a bit about my own nginx configs. After all of the work I did, I feel like I have an okay grasp on git now, which is something I couldn't say for the 11 years I was using GitHub. There is still a lot to learn, but I'll figure those things out in time. For now, I can just be happy that I found a way to control my own data even more.

One more self-hosting project from scratch done, quite a few left to go.


Blanket Fort Webring

<< Prev - Random - Full List - Next >>
What the heck is this?