No description
Find a file
2025-12-22 16:11:29 +01:00
.vscode secret key in sample launch.json 2025-12-22 11:42:11 +01:00
.gitignore docs WIP 2025-12-22 12:35:52 +01:00
config.go move config 2025-12-22 16:10:56 +01:00
db.go move db-reated function into its own file 2025-12-22 16:10:05 +01:00
engine.go enable structured logging 2025-12-22 16:11:29 +01:00
go.mod enable structured logging 2025-12-22 16:11:29 +01:00
go.sum enable structured logging 2025-12-22 16:11:29 +01:00
LICENSE license 2025-12-22 15:46:18 +01:00
main.go enable structured logging 2025-12-22 16:11:29 +01:00
README.md docs WIP 2025-12-22 12:35:52 +01:00
secrets.go totp secret support 2025-12-22 11:09:59 +01:00
table_migrations.go extract engine logic 2025-12-22 16:11:08 +01:00
tables.go turn Table.SkipFields into variadic function 2025-12-22 16:10:36 +01:00

gitea to forgejo migration, the hard way

I wrote this tool to automate migration from gitea to forgejo. Somebody told me this was "a drop-in replacement"... if you're here, you know it's not. In fact, it was until gitea v1.22, but now the two projects diverged too much.

Important notes

I wrote this to handle my specific use-case, with my specific gitea and forgejo versions. If everything is the same as my environment, with some luck, it works. If you use different versions, a different environment, you're practically on our own... But please contribute to this repo, in any case: if you're on this journey, let me know how you handled it.

My environment

I am moving some gitea instances (v1.25.2 on mariadb) to forgejo (13.0.3 on postgres), so I'm changing both application AND database.

I'm managing everything via docker compose.

how to do this migration

Pre-flight check

Check that source db is healthy.

docker compose exec -u git gitea gitea doctor check --run check-db-consistency --fix

(adapt this command to your environment)

backup now

Stop all container and make a backup. Really. This is important, don't skip this step.

run me

Build and run the program (look at ENV for configuration parameters).


go build .

export MARIADB_HOST=localhost
export MARIADB_PORT=3306
export MARIADB_USER=gitea
export MARIADB_PASSWORD=gitea
export MARIADB_DATABASE=gitea
export POSTGRES_HOST=localhost
export POSTGRES_PORT=5432
export POSTGRES_USER=forgejo
export POSTGRES_PASSWORD=forgejo
export POSTGRES_DATABASE=forgejo
export SECRET_KEY="KEEP IT SECRET!"

./gitea2forgejo # and pray