Syncs all your GitHub repos (public + private) to a local folder. Clones new repos, pulls existing ones.
-
A GitHub PAT needs to be already stored in git's credential helper. If you haven't done this yet:
git config --global credential.helper store git clone https://github.com/<your-username>/<any-private-repo>.git # enter username and PAT when prompted
curl -fsSL https://raw.githubusercontent.com/ragibalasad/git-stache/main/gitstache.sh | bashOr download it first if you want to read it before running:
curl -fsSL https://raw.githubusercontent.com/ragibalasad/git-stache/main/gitstache.sh -o gitstache.sh
chmod +x github-sync.sh
./gitstache.sh- Uses
git pull --ff-only— won't create merge commits, fails on diverged branches instead. - Token isn't written to disk or put in any URL.
- Override storage path for one run:
GH_SYNC_BASE_DIR=/path ./github-sync.sh