№ 031 · 2026-11-10 · shipped · gitlab vm + unas pro + docker swarm

Moving the git server in a day

gitlabforgejogitcicontainer-registrygit-lfsdockermigrationhomelab

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.

Diagram: four rows mapping Forgejo to GitLab. 38 repositories with branches, tags and LFS go through a migration script that mirrors, pushes LFS first and verifies refs, into projects in two groups. Forgejo Actions workflows are rewritten by hand into .gitlab-ci.yml on one instance runner. The container registry's images move across and compose image lines are rewritten, into GitLab's registry with blobs on the NAS. Forgejo's activity feed, 1,345 events, is exported and replayed with its original dates, so the existing history carries over. Below: every clone on the laptop has origin re-pointed only if it still pointed at the old repo, with dirty files and unpushed commits reported, never touched

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.

Side by side: a Forgejo Actions workflow that checks out, downloads a Docker CLI, builds an image and stops, next to its GitLab replacement, which logs in to the built-in registry, builds with --provenance=false --sbom=false and pushes two tags. Below, a red note: a recent Docker release adds provenance and SBOM attestations by default, so a push is an OCI index plus an attestation manifest, which GitLab's registry rejected with MANIFEST_BLOB_UNKNOWN; turning them off makes it a plain image again

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:

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.

Eight tiles: 38 repositories, 30 personal and 8 side project; 38 of 38 with refs verified; 3,660 LFS files carried, pushed before the refs; 8 CI pipelines rewritten; 18 container images in GitLab's registry with blobs on the NAS; 12 repos re-pointed, including remotes, compose image lines, deploy scripts and docs; 1,345 history events exported from Forgejo's activity feed; 1 instance-wide runner on the old git server's VM

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.

Timeline from the commit log: on 9 November at 21:40 the registry was switched on; on the 10th, at 06:19 blobs moved to the NAS, at 06:33 native nightly backups, at 07:50 the runner came up and hit the provenance gotcha, at 07:55 the side project's CI moved with the first pipeline green, at 21:00 the migration script, at 21:18 the second gotcha, LFS before refs, at 21:25 everything re-pointed across 12 repos, and at 21:28 all 38 of 38 mapped and Forgejo retired

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.