Huzaifa Rasheed

Huzaifa Rasheed

Software Engineer

Email at [email protected]


Blogs

šŸ›°ļø Hosting My Own Git Server at Home - Just Because I Could

June 5, 2025

There’s a quiet satisfaction in knowing every moving part of your stack - from the code you write, to the machine it runs on, to the pipe it travels through to get there.

A while ago, I started self-hosting various services on a modest homelab. Nothing dramatic - just a few useful tools, dashboards, and internal systems to automate life a little. The stack grew organically: one container here, a reverse proxy there, DNS tweaks, a tunnel or two… Before long, I realized something simple but annoying: I needed a sane, reliable way to push changes from my laptop to these self-hosted services, from anywhere.

Naturally, the answer was Git. But not GitHub. Not GitLab. Not even Gitea.

I mean actual Git. As in:

# On the homelab
mkdir -p ~/git/repos/my-service.git
cd ~/git/repos/my-service.git
git init --bare

# On the laptop
git remote add origin ssh://my-homelab-domain/git/repos/my-service.git
git push origin main

And that was it. A zero-cost, no-frills Git server - hosted on a machine I already owned, exposed via a dynamic DNS setup under a domain I already had.

From then on, pushing code to my services wasn’t just possible - it was delightful.

Could I have spun up Gitea? Sure. But I’d be knee-deep in YAML instead of pushing real code.

🧱 The Setup (In Spirit, Not in Steps)

I wasn’t using any GUI. Just pure Git over SSH.

There are enough tutorials online about how to host Git servers. That’s not the point here.

What made this setup interesting wasn’t complexity - it was control.

  • SSH key-based access to a hardened port, with users and keys managed manually.
  • No GUI, no web interface. Just Git over SSH - lean and fast.
  • My domain’s DDNS handled via Cloudflare’s API and a cron job.
  • All changes push directly to my homelab’s repos - instantly triggering post-receive hooks to deploy, rebuild, or restart services, like this:
#!/bin/bash
echo "Code pushed - deploying..."
cd /opt/my-service
git pull origin main
./deploy.sh
systemctl restart my-service

This tiny script replaces an entire SaaS pipeline - quietly, reliably, and instantly. No dashboards. Just power.

And with that - No middlemen. No limits. No monthly fees. Just pure, protocol-level Git, exactly as intended.

šŸ’» Why Bother?

Because every push felt like magic - not to the cloud, but to my own sky.

I wasn’t trying to optimize cost (even though this cost $0) or to outperform GitHub.

I was chasing agency.

When you build your own Git server from the ground up, you start seeing Git as more than a version control tool - it becomes a transport protocol, a filesystem, and a trigger for automation.

  • You start seeing the elegance of .git/hooks/.
  • You realize how easily Git can power your own PaaS-style deployment.
  • You stop needing hosted CI/CD tools just to move code from A to B.

šŸŒ€ The Hidden Joy

Every time I git push and watch my homelab deploy changes seconds later, I smile.

It’s not because I built something massive. It’s because I built something mine - no logins, no dashboards, no SaaS dashboards blinking red. Just a small system doing its job in the background, quietly, flawlessly.

šŸ”® Bonus Magic

I can be on a random Wi-Fi network, make a change, run:

git push origin main

…and 3 seconds later, my self-hosted service updates on my homelab with logs streaming in.

And the best part? No accounts. No web UI. No subscriptions.

Just: You → Git → Homelab → Done.

🌐 You Don’t Need This - But You Might Want It

This isn’t a tutorial. There’s no repo link at the bottom.

But if you’ve ever wondered how far you can stretch a home server, how Git really ticks under the hood, or how much you can do with nothing but a VPS, a domain, and some stubborn curiosity…

Well - this is your sign.

The next time you git push, ask: Who owns the pipe? Who controls the trigger? If the answer isn’t you - why not?