Zum Inhalt springen

From Zero to Git Hero: Hosting Your Own GitHub with Gitea on Linux

The Dev Who Refused to Be Held Hostage

Image description

It always starts the same.
You’re building something great—maybe a side project, maybe your startup’s backend. You push your first commit, create a beautiful README, and start dreaming big.

Then reality hits.

Suddenly, you’re being nudged toward premium pricing tiers, facing storage limits, or worrying about whether your private repo is actually private. And deep down, something tells you: I should own this.

That was me. And if you’re reading this, maybe that’s you too.

What if I told you that you could host your own lightweight, blazing-fast GitHub alternative… entirely for free… on your own server?

In this guide, I’ll walk you through installing Gitea, a modern and minimal Git service platform, on your own Linux box. You’ll never look at GitHub the same way again.

Let’s take the power back.

What is Gitea?

Gitea is an open source, self-hosted Git service. Think GitHub, but:

  • Lightweight
  • Super fast
  • Written in Go
  • Easy to install and maintain
  • Friendly for solo developers and teams
    Perfect if you want control, privacy, and zero dependency on third-party platforms.

Prerequisites

  • A Linux-based server (tested on Ubuntu 22.04)
  • Root or sudo privileges
  • Git installed
  • A domain name (optional, but recommended)

[Step 1: Install Required Packages & Create a Dedicated Gitea User]

– Required Packages installation

sudo apt update && sudo apt upgrade -y
sudo apt install git wget curl unzip -y

– Dedicated Gitea User creation

sudo adduser 
  --system 
  --shell /bin/bash 
  --gecos 'Git Version Control' 
  --group 
  --disabled-password 
  --home /home/git 
  git

[Step 2: Download Gitea Binary & Create Necessary Directories]

*– Gitea Binary downloading *
Visit https://dl.gitea.io/gitea to get the latest version. Then:

wget -O gitea https://dl.gitea.io/gitea/1.21.11/gitea-1.21.11-linux-amd64
chmod +x gitea
sudo mv gitea /usr/local/bin/

Note: Replace the version as needed based on the latest release.

– Necessary Directories creation

sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea/
sudo chmod -R 750 /var/lib/gitea/

sudo mkdir /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea

[Step 3: Create a Gitea Systemd Service File]

sudo nano /etc/systemd/system/gitea.service

Paste the following content:

[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target

[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target

Then reload and start:

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable --now gitea

[Step 4: Access the Web Interface]

Visit:
http://:3000
eg. 192.168.1.123
You’ll land on the installation page. Fill in:

  • Database: SQLite (for testing) or PostgreSQL/MySQL (for production)
  • Repository Root Path: /var/lib/gitea/data/git/repositories
  • Run User: git
  • Domain: Your server’s IP or domain
  • SSH Port: 22
  • HTTP Port: 3000

Once configured, click Install Gitea.

Boom 💥 — Your own GitHub is live

Conclusion

By hosting Gitea on your own server, you’re not just setting up another tool —
you’re reclaiming your autonomy.

You now:

  • Own your codebase
  • Control user access
  • Avoid vendor lock-in
  • Spend $0 while scaling

It’s a small step for your terminal, but a giant leap for your developer independence.

And hey — if you’re building a team, a startup, or just want to sharpen your DevOps edge, there’s nothing more powerful than owning the pipeline from git init to production.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert