A Gitea instance can be dumped and restored as a whole with a SQL dump of the database and a copy of all the files (lfs, avatars, etc.). The web interface provides a way to permanently migrate a project from other forges (GitHub, GitLab, etc.).
To migrate from, for instance, GitLab to Gitea, GitlabDownloaderFactory is registered to create a GitlabDownloader which implements the Downloader base interface common to all migrations (the compatibility is enforced at compile time). As an example, issues are downloaded from GitLab using the go-gitlab package and stored in memory by the migrateRepository function. This in-memory representation is then saved in Gitea using an object that implements the Uploader base interface.
dump-repowill download from Gitea and upload them to files (i.e. save them to disk).
restore-repowill download from files (i.e. load them from disk) and upload them in batch to avoid memory exhaustion.
When the project is restored, all entries (issues, etc.) are authored by the user doing the migration. The user of the forge from which the project was migrated is preserved: the updateMigrationPosterIDByGitService function records the name and numerical id for issues, pull requests, milestones, … in the OriginalAuthor and OriginalAuthorId fields.