Moving the git server in a day
Back in August I put our life in git: a self-hosted Forgejo server on the home lab, with every project getting a private repo and every change getting pushed. It worked. By November it held 38 repositories: 30 of mine, and 8 for a side project with real CI pipelines that build images and deploy them.
There was also a GitLab VM in the lab that had been running since June, doing very little. In August’s notes it’s on a list of things to decide whether to retire. In November I went the other way, and Forgejo was retired instead, on the 10th.
The honest reason I’d picked Forgejo in the first place was LFS: a few of my repos carry large files, and Forgejo handled them well. What I hadn’t realized was that GitLab does LFS too. Once that was off the table, the rest leaned GitLab’s way. It’s more of an industry standard, its pipelines and merge flows are better, and its UI is the one I find easier to manage, because it’s the one I already know.
Moving a git repository is one command. Moving a git server is mostly about everything that points at it.

Ground first, repos last
The evening before, I switched on GitLab’s container registry behind the lab’s TLS proxy and doubled the VM’s disk. Early the next morning, GitLab’s large files went somewhere better than that disk: LFS objects, registry layers, CI artifacts and uploads now live on a share on the NAS, mounted over NFS. I started down the road of an S3-style object store in front of it and then asked the obvious question. With a single GitLab server, an object store buys nothing. GitLab writes plain directories to the share, and that’s the end of it.
Backups went in the same morning, and after a backup scare on the old git server I kept this one deliberately boring: GitLab’s own nightly backup, written into the same share, seven days kept, plus the secrets file that GitLab needs for a restore and leaves out of the main archive. No custom script this time.
The pipelines
The side project went first, because its pipelines matter: push to main, build the image, push it to the registry, roll it out to the Docker Swarm. GitLab’s built-in importer brought the repositories and their issues across (it only fetches the first 30 comments per issue, so 17 stragglers were added afterwards by matching timestamps).
CI doesn’t migrate. Forgejo Actions and GitLab CI are different languages, so each
workflow was rewritten as a .gitlab-ci.yml, eight in all over the day. For the
runner I took a small liberty: it lives on the old Forgejo VM and shares the Docker
engine that Forgejo’s runner used, because the swarm’s deploy key only accepts
connections from that machine. One runner, registered to the whole instance, tagged
lab-docker, serving everything.

The rewrites came out shorter than the originals. Checkout, registry address and push credentials are all given to every GitLab job, so a pipeline is mostly just the commands you’d type yourself.
The first real snag was in those commands. A recent Docker release attaches provenance and SBOM
attestations to every build by default, so a push isn’t one image any more: it’s an
index with an attestation manifest riding along. GitLab’s registry turned those
pushes down with MANIFEST_BLOB_UNKNOWN. Adding --provenance=false --sbom=false to
every build fixed it, and the flag now sits in every pipeline with a comment saying
why, so nobody tidies it away later. The first green pipeline ran at 7:55 that
morning.
The other thirty
My own repositories went over that evening with a small script, and it’s cautious by
default. Run without --go, it only plans: what it would create, and what git alone
won’t carry (workflows, packages, releases, wiki) listed as follow-ups. Run with it,
for each repo it:
- creates the private project, and refuses to push into one that already has different history;
- mirrors every branch and tag across;
- checks that GitLab’s refs now match Forgejo’s exactly;
- re-points the local clone’s
origin, but only if it still points at that exact Forgejo repo, and reports uncommitted files or unpushed commits instead of touching them.
The second snag showed up in the first run. Nine repositories in, the family history project was rejected with “LFS objects are missing”. GitLab checks at push time that every LFS file a commit refers to is already on the server, so the large files have to arrive before the commits that mention them. One reorder in the script, and the rerun carried 423 LFS files for that repo and 3,237 for the planning repo, then skipped the repos it had already done because their refs already matched.

Everything that points at it
After that came the long tail. Compose files with image: lines naming the old
registry. Deploy scripts that push there. Docs and project notes that tell the next
person, often me or Claude, where the source of truth is. The images moved into
GitLab’s registry and those references were rewritten across a dozen repositories,
each with its own commit, so a stale reference that turns up later can be traced to
exactly when it should have changed.
One thing I didn’t want to lose was the history of the work itself. Forgejo’s activity feed, all 1,345 pushes, branch events and issue actions behind its contribution calendar, exists nowhere else. So it was exported to a file before Forgejo was shut down, and a small script replayed those events into GitLab with their original dates. It ran, and it worked: the existing history carried over intact, going back long before the move, rather than being lost at the cutover. That was one of my real worries about switching.

The last commit of the day, at 21:28, was the map file: 38 of 38.
Why it fit in a day
Mostly because the slow parts weren’t left for the end. Storage and backups went in before a single repo moved. The script verified every repository before changing anything that pointed at it, and it touched nothing on the old server, so a bad run could always be run again. The two surprises, attestations and LFS ordering, each cost a few minutes, because each one failed loudly, on the first repo that hit it, rather than quietly on all of them.
That’s the real lesson of moving a git server. Git itself takes care of the history. What actually breaks is everything around it: the pipelines, the image references, and the little pieces of config that quietly assume the old address. A migration is done when all of those point at the new place, and you’ve checked each one.