How to Self-Host Gitea on Hetzner (2026 Guide)
Gitea is a lightweight, self-hosted Git service that provides a simple interface for managing your repositories. Itโs perfect for developers looking to keep their projects private or control their own infrastructure. In this guide, we will set up Gitea on a Hetzner VPS, a cost-effective and reliable hosting solution.
Benefits of Self-Hosting Gitea
- Privacy: You control your data and access.
- Customization: Tailor your Git service to fit your needs.
- Cost-effective: Affordable VPS options are available.
Choosing a Hetzner VPS Plan
When choosing a plan for Gitea, consider the following options:
| Provider | Price | Memory | Storage | CPU |
|---|---|---|---|---|
| Hetzner | 4.15 EUR/mo | 2 GB | 20 GB SSD | 1 vCPU |
| Contabo VPS | 5.99 EUR/mo | 4 GB | 100 GB SSD | 2 vCPU |
| DigitalOcean | 6 USD/mo | 2 GB | 25 GB SSD | 1 vCPU |
| Vultr | 6 USD/mo | 2 GB | 50 GB SSD | 1 vCPU |
| Linode | 5 USD/mo | 2 GB | 25 GB SSD | 1 vCPU |
For our Gitea installation, Hetznerโs 2 GB plan is typically sufficient for a small team or a few personal projects. However, if you plan to host larger repositories or have a significant number of users, consider opting for a plan with more RAM and storage.
Setting Up Gitea on Hetzner
-
Create a Hetzner VPS:
- Go to Hetznerโs website and create an account.
- Select a desired VPS package.
- Choose your server region (preferably the closest to your location).
- Set up your server and make a note of the IP address.
-
Access Your VPS:
- Use SSH to connect to your server:
ssh root@YOUR_VPS_IP
- Use SSH to connect to your server:
-
Update the System:
- Update your package lists and install required packages:
apt update && apt upgrade -y apt install -y git sqlite3
- Update your package lists and install required packages:
-
Install Gitea:
- Download the latest Gitea release (check the Gitea releases page for the newest version):
wget -O gitea https://dl.gitea.io/gitea/vX.X.X/gitea-X.X.X-linux-amd64 chmod +x gitea
- Download the latest Gitea release (check the Gitea releases page for the newest version):
-
Create a Gitea User:
adduser --system --shell /bin/bash --gecos 'Gitea' --group --disabled-password git -
Set Up Directories:
mkdir -p /var/lib/gitea/{custom,data,indexers,log} chown -R git:git /var/lib/gitea chmod 750 /var/lib/gitea -
Configure Gitea:
- Create a configuration file:
cp gitea /usr/local/bin/
- Create a configuration file:
-
Run Gitea:
- Start Gitea with:
/usr/local/bin/gitea web
- Start Gitea with:
-
Access Gitea:
- Open your web browser and navigate to
http://YOUR_VPS_IP:3000.
- Open your web browser and navigate to
Finalizing Setup
Now you can follow the instructions on the web interface to complete the setup. Ensure you configure the database, create an admin user, and set up the necessary security considerations.
FAQs
1. Can I run Gitea on a lower-spec VPS than the Hetzner recommended plan?
While itโs possible to run Gitea on lower-spec VPS setups, it may compromise performance. A low-end system with insufficient RAM or CPU can lead to slow response times, especially with larger repositories or multiple users accessing it simultaneously. For optimal performance, even for a small number of projects, itโs recommended to opt for at least the Hetzner 2 GB plan.
2. How does Gitea compare to other self-hosted Git solutions?
Gitea stands out due to its lightweight nature and ease of setup. Alternatives like GitLab or Gogs may offer more features but often require more resources and can become unwieldy for small projects. Gitea provides essential Git operations with a clean interface, making it ideal for developers wanting a straightforward self-hosted experience without the overhead.
3. What security measures should I take when hosting Gitea?
Security is paramount in self-hosted applications. Here are steps to enhance the security of your Gitea instance:
- Always keep your Gitea installation updated.
- Enable HTTPS by obtaining a valid SSL certificate (using Letโs Encrypt for free certificates).
- Set up regular backups of your data and repository files.
- Configure firewalls on your VPS to restrict access to necessary ports.
- Regularly review your access logs for any unauthorized or suspicious activities.
For more VPS options, check out our full VPS comparison. This will help you explore other providers that might fit your needs better!