The Simplest Way to Make Gitea and Ubuntu Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running gitea and ubuntu together gives your team a fast, self-hosted Git service on Linux. Ubuntu runs the host system and storage, while Gitea handles code repos and user roles. This pair lets developers push code, review changes, and run automated builds on their own servers. You get full control over your code and your Linux host without high cloud costs. Still, you must set up user logins and host permissions with care. Poor setup choices can expose both your source code and your underlyin

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Running gitea and ubuntu together gives your team a fast, self-hosted Git service on Linux. Ubuntu runs the host system and storage, while Gitea handles code repos and user roles.

This pair lets developers push code, review changes, and run automated builds on their own servers. You get full control over your code and your Linux host without high cloud costs. Still, you must set up user logins and host permissions with care. Poor setup choices can expose both your source code and your underlying operating system.

How gitea and ubuntu handle logins and data flow

To make gitea and ubuntu work well, you must link app users to system accounts. Gitea runs as a single dedicated Linux user on the Ubuntu host. When developers push code over SSH or HTTPS, Gitea checks their keys or tokens first. Then, Gitea writes the new Git objects to the Ubuntu disk using that system account.

You should never run the Git service as the root user on Ubuntu. Instead, create a non-root system user with write rights only to the repo folders. Gitea also needs a local or remote database to store issue comments and user profiles. The app talks to this database over a local socket or an encrypted network link.

Data flows in two main ways on the host. First, developers send Git commits from their laptops to the Ubuntu server port. Second, Gitea sends webhook events or runs build jobs on Ubuntu worker machines. Each path needs its own set of network rules and limited user keys.

Common risks with shared keys and broad host roles

Many teams make mistakes when they set up Linux hosts for their Git servers. A common error is sharing one SSH key across the whole engineering team. When everyone uses the same admin key to log in to Ubuntu, logs lose value. You cannot tell which person changed a server file or deleted a code repo.

Another big risk comes from broad API tokens used by build runners on Ubuntu. Teams often create one admin token in Gitea and put it on every build server. If an attacker steals that token from one host, they can read all company code. They can also push bad code into main branches without any review.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged database queries and open network ports cause trouble too. Sometimes engineers log in to the Ubuntu host and edit the Gitea database by hand. These direct edits bypass app logs and can break repo states.

Scoping roles and network paths on your Linux host

You can fix these issues by tightening roles on both the app and the host. Start by giving each developer their own account in Gitea linked to single sign-on. Map team groups to specific repo permissions like read, write, or admin. Remove direct SSH login rights to the Ubuntu host for normal code writers.

For build workers running on Ubuntu, use narrow deploy keys instead of broad personal tokens. A deploy key should only read the exact repo needed for that single build job. Rotate these keys often and remove old tokens that no longer see active use.

Lock down the Ubuntu firewall so only needed ports keeps the session active to the network. Allow web traffic and Git SSH traffic from trusted network ranges. Block direct remote logins to the local database port from outside the host. When admins must maintain the Ubuntu server, record their commands and mask sensitive output fields. For example, masking rewrites matched fields like emails or card numbers in query results.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should Gitea run as root on an Ubuntu server?

No, never run the service as root. Create a standard Ubuntu user account with permissions scoped only to the app data folders.

How should Ubuntu build workers pull code from Gitea?

Use read-only deploy keys or narrow project tokens for each repo. Do not place personal admin tokens on shared Ubuntu build hosts.

How do we restrict admin maintenance on the Ubuntu host?

Remove shared SSH keys and tie every host login to a single person. Log all system commands and database edits for security audits.

The query runs. The emails stay hidden.