How to back up Gitea in Docker (2026)
Backing up Gitea means capturing three layers at once: a consistent dump of its PostgreSQL, MySQL and SQLite databases, the 2 data volumes where files live, and the compose/.env config. Dockstash scans the stack, runs the right dump command, and restics every layer to your storage VPS.
What Gitea stores
| Compose services | gitea, postgres |
|---|---|
| Databases detected | postgres, mysql, sqlite |
| Data volumes | gitea_data (/data), db_data (/var/lib/postgresql/data) |
| Config paths | docker-compose.yml, .env, gitea/conf/app.ini |
The backup plan
- Dump the database. Run pg_dumpall (or mysqldump --single-transaction, or sqlite3 ".backup") to capture users, issues, pull requests, and repository metadata consistently.
- Capture the Gitea data directory. Restic the /data volume, which holds the actual git repositories, LFS objects, avatars, and attachments — the repos live here, not in the database.
- Capture compose and app.ini. Restic docker-compose.yml, .env, and gitea/conf/app.ini so the SECRET_KEY and INTERNAL_TOKEN match; they are needed to decrypt stored secrets on restore.
Restoring Gitea
The database holds issues and metadata while /data holds the actual git repositories — restore both. Preserve SECRET_KEY and INTERNAL_TOKEN from app.ini or 2FA secrets and tokens break.
Back up Gitea in one click All guides
Last updated: July 2026
Frequently asked questions
Are my git repositories in the database?
No. Gitea stores repository metadata (users, issues, PRs) in the database but keeps the actual git repositories, LFS objects, and attachments in the /data directory. You need both.
Which databases does Gitea support?
PostgreSQL, MySQL/MariaDB, and SQLite. Dockstash detects the configured backend and dumps it the correct way for that engine.
What is app.ini and why back it up?
It is Gitea’s config, including SECRET_KEY and INTERNAL_TOKEN used to encrypt stored secrets and sign tokens. Restore it or 2FA and stored credentials break.