Published 2026-01-07
tag(s): #random-thoughts #programming #meta
I started writing about this a couple times. Once I actually had the post almost done, but
when revisiting it, I had a feeling I was leaving out things.
Today I realized the reason is that there's more than one angle on the subject - confirmed
just now as I was archiving repositories in GitHub.
What I need for this one, is to focus only on two things: the why, and the how.
Because I am self hosting git in
"my" Digital Ocean VPS, not
literally self hosting in hardware I own.
Someday...
Or maybe never.
On Monday, I told someone at work I had setup a git server over the weekend and he asked "why do you do these things?". "These" because in the past I was similarly questioned on why bother with Peanut Butter when there's a ton of Pastebin clones. Or why host my own blog written from scratch rather than using, say, Wordpress.
So the first part of the why is: because it is fun.
I wish I had a better reason.
Well, actually, I don't. That's a pretty good reason. Someone already explained this: "You can choose tools that make you happy".
Because people make technical decisions, in part, for affective reasons. They choose a technology because it feels good, or comfortable, or because it's what they know. They choose obscure tech as a form of sympathetic magic, like the guy who uses NetBSD on a ThinkPad to feel like a William Gibson protagonist. They choose obsolete languages, like Lisp or Smalltalk, because they think of the heroic age of Xerox PARC, and they want to feel connected to that tradition.
Today at lunch, this topic came up again, and another person said but why, you can have
free repositories in many ways
.
And they are right, but they are also completely wrong. There's free hosting and repositories,
and they are free from a monetary point of view. But, hasn't the GitHub/Copilot fiasco taught
us anything?
We all put our code up there, "for free", with our precious little licenses. And
then one of the most litigious and IP-protecting software corporations in the planet scooped
it all up, disregarding those LICENSE terms because the fine print in our
"free" software hosting said we were also giving away many, many rights.
And this is a lesson we have learned in many other online services.
Everything that is free will be taken down when the angel investors give up on it, sold to one
of the few players that can afford the astronomical valuation of the new hot
thing [2], and/or enshittified.
So I guess the other reason I have "my own" online space, publish little tools, and
now I have my own git server is: it makes me feel empowered.
I have no illusions that it will change the world. But I don't need it to. I content on making
the change for myself.
Eons ago I visited https://depp.brause.cc and got curious
about building something similar. Just like with
the Emacs theme, moving
the blog to a VPS, etc, etc. Once the seed is in my brain, it might take a few days, or
months, or years (like in this case, I think). But I eventually give the object of my
curiosity a good try.
An extra motivator is that Source Hut doesn't provide write access over HTTPS, and SSH is
blocked on the (shared) Linux dev server at work. So when I modified something in my "office
dotfiles" I: generated a patch, copied it to the host, applied it in the repo checked out on
the laptop, pushed it. Eventually pulled it in my environment on the server, but first I had
to discard all changes. Not the worst, but annoying.
(This will matter later)
So anyway, last weekend I followed the guide
"Setting up
Git on the server", and sooner than I expected I was able to push to a repo on my laptop!
Yay!
Then I tested it on my work laptop. It worked locally, but not from the server. So I setup
anonymous HTTPS access. I was now in the same state as before, but using my own git hosting.
Yay again.
One more decision I made on the initial setup is that maybe some day I write my own
"web view" for my repos. But for sure I don't want to deal with that right now,
because it seems there's a lot of potential problems with GitWeb/cgit and constant crawling.
So I figured I would mirror things to Source Hut and keep it for public use, since it has
trackers and other niceties.
For synchronization, I just added a new remote with both repositories and pushed from my
laptop. It seemed to work fine.
Then on Monday I went to the office, and from that network I couldn't reach my own repo even
from the laptop. Good thing I didn't move everything right away. =D
That night I
configured SmartHTTP,
with proper security so I could enable writes, and then the problems started. Because the
files had to be accessible by
www-data without breaking access via SSH, which is the first thing I
happened.
But after going over some blog posts and nginx docs and trying a bunch of things, I finally
had everything working. 🥳
But why stop there, right?
I sacrificed some sleep to make progress into setting up mirroring via hooks. I finally got it
working on Tuesday night and what I think is my final setup is:
I learned about a lot of things: mirroring, configuring bare repositories, some SSH stuff,
using git's hooks, some more about Linux permissions, and even more nginx configuration.
So that is a whole yak shaved over a couple nights.
Like I said, it was fun. 😎