Save your GitHub repositories to a local directory.
You must have Node.js and npm
installed globally on your machine.
Then, install the project dependencies:
npm install
Create a personal access token (classic) with the repo
scope.
Export your variables by running the following commands in your terminal:
export GITHUB_TOKEN="<personal-access-token>"
export BACKUP_DIR="<path-to-backup-directory>"
BACKUP_DIR
is the absolute path to the directory where you want to save your repos.
This script will clone all your repositories to the BACKUP_DIR
directory.
npm run clone
You might want to save some cool GitHub public repositories as well.
To do so, add the URL of the repos in the repos.json
file and run the following command:
npm run public
They will be saved in the
$BACKUP_DIR/public
directory.