-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
Yes.
The GitHub API is authenticated with a Personal Access Token, so repositories accessible to that GitHub account can be discovered, including private repositories.
The SSH key used for Git operations must also have access to the repositories being mirrored.
They are used for different purposes.
Personal Access Token
Used for:
- repository discovery
- GitHub API authentication
SSH key
Used for:
- cloning repositories
- updating existing mirrors
The token is never embedded into Git repository URLs.
No.
The script uses standard tools:
bash
git
curl
jq
ssh
GitHub CLI is not required.
It backs up repositories returned by the GitHub API for the authenticated account.
This includes repositories where the account is an:
- owner
- collaborator
- organization member
Repositories to which the account has no access cannot be discovered or mirrored.
The local mirror is not automatically deleted.
Instead, the script reports it as an orphaned mirror.
ORPHANED MIRRORS
! project-old.git
The backup is intentionally preserved.
This prevents an accidental GitHub deletion from immediately becoming a local backup deletion as well.
The old local mirror is preserved.
Depending on how the repository appears during discovery, it may subsequently be treated as an orphaned mirror while the renamed repository receives its own local mirror.
This means a rename does not automatically destroy the old backup.
The backup continues.
A failed repository is recorded and the remaining repositories are processed.
The final exit code becomes:
1
instead of 0.
This allows scheduled monitoring to detect the problem without losing the rest of the backup run.
The script uses a lock directory to prevent concurrent executions.
The second instance detects the existing lock and exits.
This prevents two processes from modifying the same mirror simultaneously.
It can be.
The first run has to download every repository and all required Git objects.
The amount of data depends on:
- repository count
- repository history
- repository size
- network speed
- storage performance
Later runs are incremental and normally require considerably less data transfer.
No.
The current project is a Git repository mirror, not a complete GitHub account backup.
GitHub-specific metadata such as Issues, Pull Requests, Actions artifacts, Releases metadata, permissions and settings require separate backup mechanisms.
Not as part of the normal repository mirror.
A GitHub Wiki is technically a separate Git repository and requires separate handling if it needs to be included in the backup.
Does it back up Git LFS?
Not automatically as a complete LFS backup.
Git LFS stores large objects separately from normal Git objects.
Repositories using LFS therefore require an additional LFS backup procedure.
See:
Yes.
Create an empty destination repository and push the mirror:
git --git-dir=/path/to/repository.git \
push --mirror git@github.com:USERNAME/repository.gitSee:
[Recovery](Recovery)
Yes.
The mirror is a normal bare Git repository and is not tied to GitHub.
It can be pushed to another Git server supporting Git over SSH.
No.
The script is intentionally designed to run directly on the host.
This makes it suitable for NAS systems and small Linux servers where running an additional container would provide little benefit.
It does not automatically delete orphaned repository mirrors.
The only automatic cleanup currently performed is log rotation.
Old log files beyond LOG_KEEP are removed.
Repository data is intentionally left untouched.
No.
The token is read from a separate local file:
~/.config/github/token
It should never be committed to Git.
The script also avoids placing the token into Git remote URLs.
Yes.
The script was designed with NAS environments in mind.
It can be executed manually or through Synology DSM Task Scheduler.
See:
[Installation](Installation)
and
[Scheduling](Scheduling)
No.
The backup is non-interactive.
The GitHub API uses the stored token and Git uses the configured SSH key.
This allows the script to run unattended through cron or a NAS scheduler.
The API and Git operations can fail independently.
The script reports the affected operation and continues processing where possible.
Individual repository failures result in exit code 1.
A fatal failure that prevents the backup engine from operating results in exit code 2.
It is a Git repository backup tool, not a complete GitHub disaster-recovery system.
For source repositories, a mirror provides a strong independent copy of the Git data.
A complete GitHub account backup would additionally require handling GitHub-specific metadata and services.
The scope is intentionally kept small:
GitHub
↓
Git repositories
↓
Local mirrors
Simple enough to understand, automate and recover from.