Skip to main content

Choose where backups go

The worker writes one archive per repository to the storage you set in its settings file, worker.env. Choose the storage with BACKUP_SINK: local, s3 or git.

Private repositories are backed up as well. Keeping the folder or bucket private is up to you.

A folder on a disk​

BACKUP_SINK=local
BACKUP_LOCAL_DIR=/srv/backups/github
  • The folder must already exist. If a backup disk is not mounted, the run fails instead of filling your system disk.
  • Each archive gets a checksum file next to it, <name>.bundle.sha256.
  • When a repository changes, the archive before it is kept as <name>.bundle.prev. That is one older copy, enough to undo a force-push on GitHub. For a longer history, snapshot the folder with your file system or backup tool.

A network share works the same way, as long as it is mounted at that path when the backup runs.

An S3-compatible bucket​

BACKUP_SINK=s3
BACKUP_S3_ENDPOINT=s3.eu-central-1.amazonaws.com
BACKUP_S3_REGION=eu-central-1
BACKUP_S3_BUCKET=my-github-backups
BACKUP_S3_PREFIX=github/
BACKUP_S3_ACCESS_KEY_ID=...
BACKUP_S3_SECRET_ACCESS_KEY=...
ProviderBACKUP_S3_ENDPOINTBACKUP_S3_REGION
AWS S3s3.<region>.amazonaws.comThe bucket's region
Cloudflare R2<account-id>.r2.cloudflarestorage.comauto
Backblaze B2s3.<region>.backblazeb2.comThe region in the endpoint
Wasabis3.<region>.wasabisys.comThe bucket's region
RustFS on your own machinehost:9000, with BACKUP_S3_USE_SSL=false for plain HTTPOptional
Garage on your own machinehost:3900, with BACKUP_S3_USE_SSL=false for plain HTTPThe s3_region in garage.toml
A MinIO server you already runhost:9000, with BACKUP_S3_USE_SSL=false for plain HTTPOptional

To keep backups on your own hardware, run an S3-compatible server and point the worker at it:

  • RustFS is open source (Apache-2.0) and supports bucket versioning. Version 1.0 came out in September 2026, so it is young: test a restore before you rely on it.

  • Garage is open source (AGPL-3.0) but has no bucket versioning yet. The worker warns about that, and a changed repository replaces its only copy in the bucket.

  • MinIO's open-source server is no longer developed (its repository is archived). A MinIO server you already run keeps working with the same settings.

  • Create the bucket first. The worker never creates one.

  • Give the access key permission to list, read and write objects in that bucket only.

  • Turn on bucket versioning. Each run replaces the object of a changed repository; versioning keeps the earlier ones. Add a lifecycle rule that deletes old versions after, for example, 90 days. The worker logs a warning when versioning is off.

  • Every run reads each stored archive back to check it is intact (see below). With a bucket that means downloading it, so check what your provider charges for downloads. BACKUP_VERIFY_CONTENT=false turns the full read off and checks only the size and checksum.

A git repository​

BACKUP_SINK=git
BACKUP_REPO_PATH=git@github.com:your-login/github-backups.git

The worker commits the archives to that repository and pushes them. This suits a small number of small repositories:

  • Files over 100 MiB cannot be pushed to GitHub. Those repositories are recorded as too large and not stored; use a folder or a bucket for them.
  • Private repositories are stored only when GitHub confirms that the destination repository is private. Otherwise they are held back and the run says so.
  • The destination only grows, because every change adds a new archive to its history.

How the worker checks your backups​

Before it skips an unchanged repository, the worker checks that the stored archive still has the recorded size and checksum and, by default, reads it back in full. An archive that is missing, damaged or unreadable is backed up again in the same run. Damage in place usually means a failing disk or bucket problem, so the run then finishes with a warning to check the storage.

To check everything without backing up, run github-backup-worker verify with ENV_FILE pointing at your settings file. It restores every archive in a temporary folder and reports any that fail. See Restore a repository.

Change the storage​

Change BACKUP_SINK and its settings, then run a backup. The first run after the change writes every repository to the new storage. The old storage is left as it was.

What an archive contains​

  • Every branch and tag, with full history.
  • Not GitHub's pull request refs, issues, wikis, releases or Actions settings: only the git repository.
  • Not Git LFS files. The archive holds the LFS pointer files only, so back up LFS objects separately.