Forgejo is the community-governed fork of Gitea that emerged in late 2022 when the upstream project announced a commercial entity. For operators the practical difference is small — same Go binary shape, same app.ini, same repo layout — but the governance model, the federation roadmap, and the Codeberg sponsorship matter to teams who want a Git platform that cannot be reshaped by a single vendor. This article covers a fresh install and a clean migration from Gitea.
How to verify
If migrating, snapshot the current Gitea state first. If installing fresh, confirm host shape:
gitea --version 2>/dev/null || echo "no gitea"
systemctl status gitea 2>/dev/null | head -5
psql -U gitea -d gitea -c '\dt' 2>/dev/null | head -10
ls /var/lib/gitea/git/repositories 2>/dev/null | head -5
df -h /var/lib/gitea
Migrations are essentially binary swaps — Forgejo reads Gitea’s app.ini and database verbatim through the 1.x line. The 7.x+ line introduces schema changes that need a one-way migration. Confirm versions before starting.
What’s happening
Forgejo forked from Gitea 1.18 and has tracked feature parity while diverging in two areas: ActivityPub federation (so Forgejo instances can follow each other, eventually) and policy decisions around licensing and packaging. The binary is a drop-in replacement up through the 1.x lineage. From 7.x onward, the file layout, database schema, and app.ini keys diverge enough that you migrate forward but not back without database snapshots.
The migration architecture mistake we see: people stop Gitea, swap the binary, start Forgejo, and skip the database backup. If something goes wrong with a schema upgrade — and across the 1.x → 7.x boundary, something occasionally does — you are stuck without a rollback path. Always snapshot the database first.
The procedure
Fresh install
-
System packages and user (same as Gitea):
apt update && apt install -y git postgresql nginx adduser --system --shell /bin/bash --group --disabled-password \ --home /home/git git -
Postgres database.
sudo -u postgres psql <<'SQL' CREATE USER forgejo WITH PASSWORD 'replace-me' LOGIN; CREATE DATABASE forgejo OWNER forgejo TEMPLATE template0 ENCODING 'UTF8' LC_COLLATE 'C' LC_CTYPE 'C'; SQL -
Fetch the binary.
FORGEJO_VERSION=7.0.5 curl -L -o /usr/local/bin/forgejo \ https://codeberg.org/forgejo/forgejo/releases/download/v${FORGEJO_VERSION}/forgejo-${FORGEJO_VERSION}-linux-amd64 chmod +x /usr/local/bin/forgejo -
Directories, systemd, install — identical to a Gitea install with
forgejoin place ofgiteain the systemd unit andapp.inipath. Use/etc/forgejo/app.iniand/var/lib/forgejo/.
Migration from Gitea
-
Snapshot the database.
sudo -u postgres pg_dump -Fc gitea > /var/backups/gitea-pre-forgejo-$(date +%F).dump -
Stop Gitea and back up the data directory.
systemctl stop gitea tar czf /var/backups/gitea-data-$(date +%F).tar.gz /var/lib/gitea /etc/gitea -
Install the Forgejo binary at the same path. For a 1.x line swap (e.g. Gitea 1.21 → Forgejo 1.21):
curl -L -o /usr/local/bin/gitea \ https://codeberg.org/forgejo/forgejo/releases/download/v1.21.11-0/forgejo-1.21.11-0-linux-amd64 chmod +x /usr/local/bin/gitea systemctl start giteaNote: we keep the binary at
/usr/local/bin/giteafor a 1.x line swap becauseapp.iniand the systemd unit expect that path. Forgejo’s binary will respond to that name without issue. -
For the 1.x → 7.x migration, the upstream Forgejo migration guide is the authoritative source. The summary: stop the service, set
INSTALL_LOCK=trueandRUN_MODE=prodinapp.ini, run the binary once with--config /etc/gitea/app.ini doctor convertto upgrade the schema, then start as a service. -
Verify after migration.
sudo -u git /usr/local/bin/gitea --config /etc/gitea/app.ini doctor check curl -s https://git.example.com/api/v1/versionThe version endpoint should report a Forgejo string. Issues, PRs, and webhooks should be unchanged.
-
Rename paths if desired. Many operators keep
/var/lib/giteaand/etc/giteato avoid touching backups, monitoring, and Nginx vhosts. There is no functional reason to rename; do it only when you are also rebuilding monitoring.
Common pitfalls
- The 1.x → 7.x jump without a database snapshot is the rollback you will not have when something goes wrong; always
pg_dump -Fcfirst. - Federation enabled by default in 7.x if you flipped
[federation] ENABLED = trueexposes activity to the public Fediverse — confirm this is intentional before opening it. - The
RUN_USERmismatch (Gitea ran asgit, you start Forgejo asforgejo) leaves the repository directory owned by the wrong user; either keepgitorchown -Rthe tree. - Forgejo Actions runners and Gitea Actions runners are mostly interchangeable but the registration token format changed at some 1.x point; re-register runners after a major upgrade.
- Keeping the binary path at
/usr/local/bin/giteaduring a 1.x swap is fine; renaming toforgejorequires updating the systemd unit and any monitoring that greps forgiteain process lists.
Stack Harbor runs Forgejo for clients who want the calm, community-governed Git platform behind their own TLS — Postgres tuned, Actions runners scaled, migrations from Gitea staged with full database snapshots, and the federation flag left intentionally off unless the client has a reason. The procedure above is the migration we run, including the rehearsal we do on a clone of the database before touching production. For clients running this as a managed environment, our managed operations service is the operating model.