A local Forgejo mirror of BeschleunigerBallett#
Status: proof of concept. One public repository is pulled from GitHub into a Forgejo instance on the owner’s Linux host. No CI runs on it.
Why#
The owner asked for a GitHub alternative. A mirror comes first, because it needs no CI and no runner.
What runs where#
Part |
Value |
|---|---|
Engine |
|
Image |
|
Container |
|
Data |
the named volume |
Address |
|
SSH |
off |
Limits |
1 GB memory, 2 CPUs |
Restart |
none: start the container by hand |
The admin password and the API token stay in the owner’s configuration folder, with mode 600. They are not in a repository or on this page.
Start and stop#
Start:
nerdctl start forgejo-bb.Stop:
nerdctl stop forgejo-bb.Health:
curl -fs http://127.0.0.1:3300/api/healthzon the host, or the same path with the host’s LAN address from another machine.The LAN address is set as
ROOT_URLin the container. If the host gets another address, recreate the container with the new value.
The mirror#
The mirror is a pull mirror of the public GitHub repository. It was created with
POST /api/v1/repos/migrateandmirrorset to true.Forgejo fetches it every hour (
mirror_interval1h).To fetch now, call
POST /api/v1/repos/<owner>/<repo>/mirror-syncwith a token.Submodules are not mirrored. Their URLs in
.gitmodulesstill point to GitHub.
Why git runs through a shim#
The migration failed on the history. An old version of .gitmodules holds the URL https://github.com:gabime/spdlog.git, with a colon where the slash after the host belongs. The URL was added in one commit and removed in a later one. Git’s strict object check refuses it, and the fetch ends with fsck error in packed object. GitHub accepts the same history.
Forgejo passes its own object-check options on every git call. Those options override the git configuration, so a setting in the configuration did not lift the check.
The proof of concept runs git through a small shim, mounted at /usr/local/bin/git in the container. The shim removes the transfer.fsckObjects, fetch.fsckObjects and receive.fsckObjects options from the command line. It then sets those three to false through the environment. Every other argument passes through unchanged. The shim lives in the owner’s configuration folder.
Risk#
With those three options off, git skips every object check on fetch, receive and transfer. The submodule URL check is only one of them. The checks guard against crafted objects, which can make git run something it should not. The instance is reachable from the local network, and registration is off. The admin account is the only login. For a mirror of one public repository, the risk is small. Review it before the instance serves other users or other repositories.
Real fixes, not done#
Rewrite the history to correct or remove the URL. That rewrites published commits, so it is an owner decision.
Check whether a newer Forgejo release accepts this history. This is not tested.
Limits and next steps#
No CI, no runner, and no pushes from the local side.
Each next step is a decision: a second remote, a Forgejo runner on this host, or the local instance as the primary remote.