3 Repository Mirroring
official-markus-maurer edited this page 2026-07-16 11:57:15 +02:00

Repository Mirroring

An ordinary clone is not a complete preservation strategy. Canonical captures use mirror clones, collect submodules and LFS objects, create offline snapshots, and verify recovery.

Initial capture

mkdir -p /srv/preservation/git/mirrors/github.com/LandSandBoat
git clone --mirror \
  https://github.com/LandSandBoat/server.git \
  /srv/preservation/git/mirrors/github.com/LandSandBoat/server.git

git -C /srv/preservation/git/mirrors/github.com/LandSandBoat/server.git fsck --full
git -C /srv/preservation/git/mirrors/github.com/LandSandBoat/server.git show-ref > refs.txt

For repositories using Git LFS:

git -C /srv/preservation/git/mirrors/<repo>.git lfs fetch --all
git -C /srv/preservation/git/mirrors/<repo>.git lfs fsck

Mirror submodules separately. The parent repository stores only their URLs and commit IDs, not their objects:

git --git-dir=/srv/preservation/git/mirrors/<repo>.git show HEAD:.gitmodules

Record every submodule as its own mirror inventory entry and confirm the referenced commit exists.

Updating a mirror

git -C /srv/preservation/git/mirrors/<repo>.git remote update --prune
git -C /srv/preservation/git/mirrors/<repo>.git fsck --full
git -C /srv/preservation/git/mirrors/<repo>.git show-ref > refs.txt

Automated updates should log upstream deletion or force-pushes before pruning evidence. For high-risk disappearing projects, snapshot the old mirror before any update.

Offline bundles

Create dated bundles after important captures:

git -C /srv/preservation/git/mirrors/<repo>.git \
  bundle create /srv/preservation/git/bundles/<repo>-YYYY-MM-DD.bundle --all

git bundle verify /srv/preservation/git/bundles/<repo>-YYYY-MM-DD.bundle
sha256sum /srv/preservation/git/bundles/<repo>-YYYY-MM-DD.bundle \
  > /srv/preservation/git/bundles/<repo>-YYYY-MM-DD.bundle.sha256

Some refs may not be representable in a bundle when their histories overlap or are unreachable. Preserve the bare repository with a filesystem-aware backup as well.

Forgejo pull mirrors

A Forgejo pull mirror is useful for discoverability and day-to-day redundancy, but it is not sufficient alone:

  • Mirror scheduling can stop silently due to authentication or upstream errors.
  • Deleted or force-pushed refs may propagate.
  • LFS, releases, issue attachments, wikis, and external documentation need separate checks.
  • The Forgejo instance itself must be backed up independently.

Use both a Forgejo mirror and an offline archive when licensing and permissions allow.

Minimum mirror inventory

Field Example
id github.com/LandSandBoat/server
canonical_url https://github.com/LandSandBoat/server.git
mirror_url Internal Forgejo URL
acquired_at ISO 8601 timestamp
last_fetch_at ISO 8601 timestamp
head_commit Full object ID
refs_manifest_sha256 Hash of sorted ref list
uses_lfs true / false / unknown
submodules_checked date and result
license SPDX ID or NOASSERTION
access public / restricted / private
backup_locations Opaque location IDs, not secrets
restore_tested_at Date and test record

Use Template — Repository Mirror.

Recovery test

At least quarterly, recover a selected bundle or bare-repository backup into an empty directory, run git fsck --full, check out the pinned revision, initialize submodules from preserved mirrors, materialize LFS objects, and attempt the documented build. A checksum check without a restore test is incomplete evidence.

Seed mirror list

Project Upstream Notes
LandSandBoat https://github.com/LandSandBoat/server.git Forgejo mirror; preserve client-data compatibility with each pin.
pydarkstar https://github.com/AdamGagorik/pydarkstar.git Forgejo mirror; optional LandSandBoat tooling.
Project Meteor https://bitbucket.org/Ioncannon/project-meteor-server.git Forgejo mirror; develop and tags captured.
Sapphire https://github.com/SapphireServer/Sapphire.git Forgejo mirror; data-version mapping remains open.
TrinityCore https://github.com/TrinityCore/TrinityCore.git Forgejo mirror; full history present.
Aura Kingdom installer source https://github.com/nathawut1992/ak_oneclick_installer Forgejo mirror; release links have known gaps.

Add PrivateServer-RS itself and PrivateServer-RS.wiki.git to the backup inventory.

See Mirror Inventory for captured refs, bundle checksums, and outstanding verification.