Where Does Forgejo Store Config, Repos, and Data?
Where Forgejo keeps app.ini, repositories, database, and logs on Linux package and Docker installs.
Last updated
Forgejo inherits the Gitea layout: config in /etc/forgejo/app.ini, all data in /var/lib/forgejo (repositories, database, avatars, logs), with Docker remapping data to /data. The binary itself is stateless.
Migrations move two trees plus a database dump when external. The secret key in app.ini is the easily forgotten third piece: without it, sessions and OAuth tokens silently invalidate on the new box. Keep all three together and version upgrades stay boring. The doctor subcommand checks paths early.
Where Forgejo stores this, by platform
/var/lib/forgejo
repositories/, forgejo.db (SQLite default), avatars/, attachments/, and log/ here, owned by the git user. Docker maps this tree to /data via volume. External databases live outside it and need their own dumps.
/etc/forgejo/app.ini
app.ini plus the INSTALL_LOCK state and secret key. Test edits with forgejo doctor or a config check before restarting. Environment variables with FORGEJO__ prefixes override file values in containers.
Frequently asked questions
how do i migrate forgejo to a new server
Copy /var/lib/forgejo (repos, database, avatars, attachments) plus /etc/forgejo/app.ini to the new box, keeping ownership on the git user. Dump the database separately if it runs on Postgres or MySQL instead of SQLite. Start the same version first, then upgrade.
which forgejo config file should i edit
Only app.ini (and the secret key inside it). Never edit the shipped defaults; app.ini overrides them. A lost INSTALL_LOCK or secret key breaks sessions and tokens, so that file joins every backup.
where is the forgejo data directory
In /var/lib/forgejo (repositories/, indexers/, avatars/, and forgejo.db for SQLite). Gitea habits transfer directly since the layout is inherited. Docker images map it to /data, so check the volume rather than the host root.
Notice an outdated path? Let us know.