How to install Gitea to have a local Git server

Last update: 3 September 2026
  • Gitea is a lightweight alternative to GitLab and GitHub that consumes very few system resources.
  • The installation is based on an executable binary managed as a service through SystemD.
  • Using a reverse proxy with Nginx is essential to enable secure access via HTTPS.
  • It allows migrating existing repositories from other platforms while maintaining issues and tags.

Server racks in a data center, representing the infrastructure of a local Git server.

If you're tired of relying on the rules, costs, or availability of giants like GitHub or GitLab, building your own infrastructure is the way to go. Having a Git server at home or in your own office gives you the keys to the kingdom: absolute control over the code , total access management, and the peace of mind of not having third-party limitations on your private repositories.

Among all the available options, Gitea stands out as a gem. It's a tool written in Go, which makes it incredibly lightweight and fast , ideal for those who don't want to dedicate 16 GB of RAM to a Git server. Unlike GitLab, which is a feature-rich but resource-intensive ocean liner, Gitea is like a speedboat: it gets straight to the point, consumes very few resources, and offers a very familiar interface for anyone who has used GitHub.

Quick comparison: Gitea, GitLab, and Forgejo

Software engineer configuring a server using a laptop in a server room.

Before diving into the installation, it's worth knowing what you're getting into. GitLab is the quintessential enterprise option, ideal for large teams that need integrated CI/CD, but it requires powerful hardware. Gitea, on the other hand, is the best choice for modest servers or personal projects due to its very small memory footprint. Finally, there's Forgejo, a community fork of Gitea; if you're a free software purist and prefer open governance without corporate overtones, this is the alternative for you.

  What is a server and how it works: Types and characteristics

What you need before you start

Laptop computer displaying lines of code in a modern workspace, ideal for illustrating Git repository management.

To ensure everything runs smoothly, make sure you have a Linux server (either Ubuntu, Debian, or Rocky Linux) with root access. It's also essential to have Git installed on the machine, and while Gitea allows the use of SQLite, for production environments, PostgreSQL or MariaDB are highly recommended to guarantee data stability.

Preparing the ground in the system

Close-up of hands programming on a keyboard, representing software development and the use of Gitea.

Running Gitea as root is not a good idea for security reasons. It's best to create a dedicated user. You can do this by running the command adduser --system --shell /bin/bash --group --home /home/gitea gitea. It is essential to use /bin/bash as shell because Gitea needs to interact with git-shell via SSH. If you don't already have Git installed, a simple apt install git will solve the problem quickly.

Binary installation and folder structure

Detail of Ethernet cables connected to a network switch, illustrating the network configuration and reverse proxy.

Gitea can be installed in several ways, but the binary is the most straightforward. You should locate the latest stable version on its official website and download it using [method/method]. wget en /usr/local/bin/giteagiving it later execute permissions with chmod +xFor the program to function correctly, a series of specific directories must be created: /etc/gitea for configuration and /var/lib/gitea for custom data, logs, and files. Don't forget to adjust the property permissions (chown) so that the user gitea can write to them.

Database configuration

If you choose PostgreSQL, you will need to install the package and create a specific role with a strong password, in addition to the database. giteadb with UTF8 encoding. If you prefer MariaDB, the process is similar: you create the database and the user, making sure that the storage engine is InnoDB and that the server is listening on port 3306.

  MCP server support in a GNOME environment: a complete guide

Automation with SystemD

To avoid having to manually start Gitea every time you restart the server, it's best to create a drive file in /etc/systemd/system/gitea.serviceThis file tells the system that Gitea must be run as a servicedefining the user, group, and binary path. Once created, simply run systemctl enable --now gitea and the server will start listening, by default, on port 3000.

The first contact with the web interface

When entering http://tu-ip:3000You will then encounter the setup wizard. This is where you connect the database (specifying the host, username, and password) and define the general site settings, such as the instance name and base URL. It's also time to configure the SSH server and decide whether you want anyone to be able to register or if you prefer... disable public logging to keep the server private.

Security and professional access with Nginx

Accessing Gitea through port 3000 is inefficient and insecure. The ideal solution is to set up a reverse proxy with Nginx . This allows users to access the site via a domain (e.g., git.yourdomain.com) and ensures all traffic is encrypted using Let's Encrypt SSL certificates . In the Nginx configuration, simply redirect traffic from port 443 to Gitea's port 3000, adding the X-Forwarded-For headers to avoid losing the client's real IP address.

User management and code migration

If you disabled open logging, you can create the first administrator using the command line with the command gitea admin user createOnce inside, you can add your public SSH keys in the user profile to clone repositories without entering the password each time. If you already have code on GitHub, Gitea has a integrated migration tool It automatically imports not only the code, but also the issues and tags.

  How to automate workflows with n8n and Docker

Maintenance and tuning

Maintaining Gitea is incredibly easy. To update, simply download the new binary, replace the old one, and restart the service. For backups, use the command gitea dump It's your best friend, because it generates a compressed file with everythingDatabase, configuration, and repositories. For email, you can configure an external SMTP server (such as Gmail) or install Postfix on the server to receive notifications of pull requests and alerts.

Implementing Gitea allows you to have a robust, lightweight, and fully private version control platform, eliminating dependence on external services through a binary-based installation, an optimized database, and a reverse proxy that guarantees traffic security via HTTPS.