Linux

Where Does Gitea Store Config, Repos, and Data?

Where Gitea keeps its app.ini config file, git repositories, database files, and logs on Linux.

Last updated

Gitea splits state two ways: config in /etc/gitea/app.ini, all data in /var/lib/gitea (repositories, database, avatars, logs). Docker remaps data to /data while the binary stays stateless.

Migrations move both trees plus an external database dump when applicable. The secret in app.ini is the forgotten third piece: without it, sessions and tokens silently die on the new box. Keep all three together and upgrades stay boring. The dump subcommand exports the database consistently.

Where Gitea stores this, by platform

Linux
/var/lib/gitea

repositories/, gitea.db (SQLite default), avatars/, attachments/, and log/ here owned by git. Docker maps it to /data via volume. External Postgres or MySQL lives outside and needs its own dumps.

Linux
/etc/gitea/app.ini

app.ini with the secret key and INSTALL_LOCK state. Environment variables with GITEA__ prefixes override file values in containers. Keep a commented copy of every change for upgrades.

Frequently asked questions

how do i migrate gitea to a new server

Copy /var/lib/gitea (repos, database, avatars, attachments) plus /etc/gitea/app.ini to the new box, keeping the git user ownership. Dump external databases separately when not on SQLite. Start the same version first, then upgrade.

which gitea config file should i edit

Only app.ini (plus the secret key inside). Shipped defaults stay pristine; app.ini overrides them. A lost secret key invalidates sessions and tokens, so that file joins every backup. Test edits with gitea doctor before restarting.

where is the gitea data directory

In /var/lib/gitea (repositories/, indexers/, avatars/, gitea.db for SQLite). Forgejo inherits the identical layout, so one habit covers both forges. Docker maps the tree to /data, so check the volume.

Notice an outdated path? Let us know.