zkbro

💡 Self-host something new day 2 - Forgejo

2025-06-24 20:02

Today I've set up a git forge on my Pi. I went with Forgejo because it was under my nose, and it seems ok. I wanted to do this so I could host some more personal thangs locally, but not on my main laptop, so if I format my laptop (which I'm prone to do), I can quickly pull in a bunch of repos again once I'm up and running again. I have GitHub and Codeberg accounts, and maybe with a bit of Forgejo tinkering I'll shuffle them over to here too.

After downloading the arm64 binary:

wget https://codeberg.org/forgejo/forgejo/releases/download/v11.0.2/forgejo-11.0.2-linux-arm64
chmod +x forgejo-11.0.2-linux-arm64

I then followed the Installation from binary instructions tic for tac.

Because I am SSHing into my Pi I couldn't load the http://localhost:3000/ within the Pi, so I first had to allow the port 3000 in ufw:

sudo ufw allow 3000

then, from my laptop I could load it up via http://192.168.1.4:3000/

I pretty much stuck with the default configurations for setting up the instance. I then created a user, and boom, I was in. It just looked like any ol online repo, except for the URL. So I made a repo:

Now, I want to clone and commit from SSH so I had to add an SSH key to my account. I changed the filename, because I already have SSH keys for other services. Once I added the .pub (public) key to the relevant Forgejo settings section, I added these lines to my ~/.ssh/config file:

Host forgejo-pi
	HostName 192.168.1.4
	User git
	Port -redacted-  ## I use a different port to the default 22, so this was required.
	IdentityFile ~/.ssh/id_ed25519_forgejo

and after testing with ssh -T forgejo-pi it authenticated my device.

Back in the dashboard, I verified my SSH Key with my private key. It didn't work the first couple of times, but after a refresh it finally verified.

So now I can do all the git things locally. Brill.

In future I might play around with a git.zkbro.com domain name, and see how I can control public/private data, but for now it's all in-house.