Leia isso em Português.
This is a simple script to backup all your GitHub repositories and put then into zip files. It also let you choose if you want to download only the private or the public repositories at a time.
First of all, you need:
- bash
- curl
- git
And that's it.
Before you begin the backups, you may need some configuration. So, take a look in the options bellow:
In this case, you don't need to generate a personal access token or get an existing one. Just pass your username when prompted by script.
And yeah, with this script you can backup all public repositories from ANY user in the GitHub. Pretty cool, huh?
For this option, you need to create or get some of yours GitHub personal access token with at least full control of private repositories. Then, you need to put it in the .env
file to retrieve your private repos info.
You will change the GITHUB_PERSONAL_ACCESS_TOKEN value in .env
, like that:
GITHUB_PERSONAL_ACCESS_TOKEN=your-fancy-personal-key
Simple do the previously configuration and you will be fine.
First, you can clone the repository to your machine:
$ git clone https://github.com/brendaw/backup-from-repos
Or, you can download the files with this curl command:
$ curl --remote-name-all https://raw.githubusercontent.com/brendaw/backup-from-repos/master/{.env,backup-from-repos.sh}
After download, give execution permission to the script, as bellow:
$ chmod +x backup-from-repos.sh
Then, choose your backup option:
Run the script with public
arg and pass your user when asked, like below:
$ ./backup-from-repos.sh public
After you configure your personal access token, run the script with private
arg. Since the private access token already have your user binded, the script will not ask for your user. Just run like below:
$ ./backup-from-repos.sh private
After you configure your personal access token, run the script with all
arg. Since the private access token already have your user binded, the script will not ask for your user. Just run like below:
$ ./backup-from-repos.sh all
You may contribute in several ways like creating new features, fixing bugs, improving documentation and examples or translating any document here to your language. Issues and Pull Requests sections are waiting for your contribution.
MIT - William Brendaw - 2020