GitHub Repository Backup Tool
Powerful Python utility for automating comprehensive backups of your GitHub repositories and gists
Downloads code as ZIP archives with parallel processing for speed and detailed reporting for insight.
github-repos-downloader — a powerful Python utility for automating comprehensive backups of your GitHub repositories and gists. This tool downloads your code as .zip archives for safe keeping, with parallel processing for speed and detailed reporting for insight.
Complete Backup Solution: Downloads all your repositories and gists as .zip archives for safe keeping, with robust error handling and detailed reports.
- Complete Backup — Downloads all your GitHub repositories and gists as
.ziparchives in a single operation - Parallel Downloads — Speeds up the process by downloading multiple items simultaneously, automatically using your available CPU cores
- Detailed Reporting — Generates a quality report with success rates, sizes, and actionable insights after each backup
- System Automation — Optionally schedules your computer to shut down or reboot after the backup completes
- Robust Error Handling — Implements retry logic, handles network timeouts, and protects against failed downloads
- Secure Token Management — Stores your GitHub token securely in your system's configuration directory
Prerequisites: Python 3.7+, curl command-line tool, GitHub Personal Access Token
Installation:
git clone https://github.com/aixandrolab/github-repos-downloader.git cd github-repos-downloader
Configure Token:
1. Go to GitHub Settings → Developer settings → Personal access tokens
2. Generate token with repo and gist scopes
3. Save token:
python app.py -t
Basic Usage:
| Command | Action |
|---|---|
python app.py -r | Download all your repositories |
python app.py -g | Download all your gists |
python app.py -r -g | Download both repositories and gists |
python app.py -r --verbose | Download repos with detailed output |
python app.py -r --timeout 120 | Download with 2-minute timeout per request |
python app.py -r --shutdown | Download repos and shutdown when done |
What Gets Backed Up?
The tool creates snapshot .zip archives of your code at a specific point in time (does not include full Git history).
- Repositories — Saved as
[repository-name].zipin therepositories/folder - Gists — Saved as
[gist-id].zipin thegists/folder
Where Are Files Saved?
~/[your_github_username]_github_downloads/
├── repositories/
│ ├── project-one.zip
│ └── project-two.zip
├── gists/
│ ├── a1b2c3d4.zip
│ └── e5f6g7h8.zip
└── reports/
└── backup_report_20251215_143022.txt
Post-Backup Archiving: By default, the entire folder is compressed into a single .zip. Use --no-archive to skip.
| Argument | Description | Default |
|---|---|---|
-r, --repos | Download your repositories | False |
-g, --gists | Download your gists | False |
-t, --token | Update or set your stored GitHub token | False |
--no-archive | Do not create a final ZIP archive of the backup folder | False |
--timeout N | Set the timeout for each download operation | 30 |
--verbose | Print detailed real-time information | False |
--shutdown | Shutdown the computer 60 seconds after finish | False |
--reboot | Reboot the computer 60 seconds after finish | False |
Note: --shutdown and --reboot are mutually exclusive.
Optimizing Download Speed:
- Uses parallel processing for batches larger than 5 items
- Workers = CPU cores minus one for optimal performance
- For large backups (50+ items): use
--timeout 120
Handling API Rate Limits:
- Authenticated users: 5,000 requests per hour
- Automatic pause and retry with exponential backoff
- Reduce
max_workersparameter if needed
| Problem | Likely Cause | Solution |
|---|---|---|
| Failed to authenticate | Token invalid, expired, or lacks scopes | Run python app.py -t to update token |
| Download timeout | Network slow or repository large | Re-run with --timeout 120 |
| Some items fail to download | Repository renamed, deleted, or forked | Check report for failures — retries up to 3 times |
| "curl" command not found | curl not installed on system | Install curl: apt install curl (Ubuntu) |
- Summary — Counts of successful/failed downloads for repos and gists
- Statistics — File sizes and success percentages
- Top Lists — Your 10 largest repositories and gists with the most files
- Failure Analysis — A list of items that couldn't be downloaded
- Insights & Recommendations — Actionable advice based on results
- Token Storage — Stored in encrypted format at
~/.config/github_repos_downloader/github_token.json - No Data Sent Elsewhere — Only communicates with GitHub's API
- Clean Operations — Temporary files deleted after use, failed downloads cleaned up
- Language: Python 3.7+
- Dependencies: requests, concurrent.futures
- External Tools: curl
- Platform: Linux / macOS / Windows
- License: BSD 3-Clause
By using this software, you agree to the full disclaimer terms.
Software provided "AS IS" without warranty. You assume all risks.
Full legal disclaimer: See DISCLAIMER.md
License: BSD 3-Clause License