
BackHub is a simple GitHub repository backup tool that creates complete local mirrors of your repositories.
The easiest way to use Backhub is to download it from the project releases for your OS and architecture.
go install github.com/tanq16/backhub@latest
git clone https://github.com/tanq16/backhub.git && \
cd backhub && \
go build
Backhub uses an environment variable to authenticate to GitHub. To do this, set your GH_TOKEN variable. This can be done inline with:
GH_TOKEN=pat_jsdhksjdskhjdhkajshkdjh backhub
Alternatively, export it to your shell session with:
export GH_TOKEN=pat_jsdhksjdskhjdhkajshkdjh
With the environment variable exported, backhub can be directly executed multiple times from the command line like so:
# config file
backhub /path/to/config.yaml
# direct repo
backhub github.com/tanq16/backhub
BackHub uses a simple YAML configuration file:
repos:
- github.com/username/repo1
- github.com/username/repo2
- github.com/org/repo3
For Docker, put the config file in the mounted directory and name it config.yaml.
To use a local mirror as a Git repository source (like when you need to restore from the backup), the following can be done:
backup remote in an existing repository:
bash
git remote add backup /path/to/your/mirror.git
git pull backup main # or any other branch
git clone /path/to/your/mirror.git new-repobash
git daemon --base-path=/path/to/mirror --export-all
git clone git://localhost/mirror.git # in a different pathbash
git clone file:///path/to/mirror.gitBeing a mirror, it contains all references (branches, tags, etc.), so cloning or pulling from it allows accessing everything as if it's the original. Use git branch -a to see all branches and git tag -l to see all tags in the mirror.
$ claude mcp add backhub \
-- python -m otcore.mcp_server <graph>