Back up all your repositories.
(I believe I modified backup-github.sh from this script. Or you could check The complete list of every GitHub backup script 😄)
The script has a mechanism to prune old backups based on their age. It prunes files older than a specified number of days (GHBU_PRUNE_AFTER_N_DAYS
).
Use ./backup-github.sh
Switch to the correct endpoint for users or organizations:
GHBU_ORG_TYPE=${GHBU_ORG_TYPE-"users | orgs"}
Export your github token:
export GHBU_TOKEN=your_github_token_here
It is necessary to set up an SSH key to connect to GitHub.