Backup and Restore
Gitea stores data in two places: the database (repositories metadata, issues, users) and the data directory (Git repository files, attachments, LFS objects). Both must be backed up.
What this page covers
- What Gitea data needs backing up
- Using
gitea dumpfor a complete backup archive - Database-level backups for PostgreSQL
- Restoring from a backup
- Scheduling regular backups
What to back up
| Component | Location | Contents |
|---|---|---|
| Database | PostgreSQL / SQLite | Users, issues, PRs, settings |
| Data directory | /data volume |
Git repos, attachments, LFS objects |
| Config file | /data/gitea/conf/app.ini |
Gitea configuration |
Using gitea dump
The built-in gitea dump command creates a zip archive of both the database and data directory:
docker exec gitea gitea dump -c /data/gitea/conf/app.ini
Scheduling backups
Use a cron job or a Kubernetes CronJob to run gitea dump on a schedule and copy the output to a remote location (S3, NFS, etc.).