GitHub Repository Backup Tool v0.2.1

Powerful Python utility for automating comprehensive backups of your GitHub repositories and gists

Downloads code as .zip archives with parallel processing, detailed reporting, and system automation.

Python CLI GitHub API Backup Cross-Platform Parallel Processing

Complete Backup Solution: GitHub Repository Backup Tool downloads all your repositories and gists as .zip archives for safe keeping. With parallel processing for speed, detailed reporting for insight, and robust error handling, it ensures your code is always backed up.

  • Complete Backup — Downloads all repositories and gists as .zip archives in a single operation
  • Parallel Downloads — Speeds up the process by downloading multiple items simultaneously, automatically using available CPU cores
  • Detailed Reporting — Generates quality reports with success rates, sizes, and actionable insights after each backup
  • System Automation — Optionally schedules computer shutdown or reboot after backup completes
  • Robust Error Handling — Implements retry logic, handles network timeouts, and protects against failed downloads
  • Secure Token Management — Stores GitHub token securely in system's configuration directory

Prerequisites

  • Python 3.7+
  • curl command-line tool
  • GitHub Personal Access Token with repo and gist scopes

Installation & First Run

git clone https://github.com/aixandrolab/github-repos-downloader.git
cd github-repos-downloader
python app.py -t  # Set your GitHub token

Basic Usage

  • python app.py -r — Download all repositories
  • python app.py -g — Download all gists
  • python app.py -r -g — Download both repositories and gists
  • python app.py -r --verbose — Download with detailed output
  • python app.py -r --shutdown — Download and shutdown computer when done

ArgumentDescriptionDefault
-r, --reposDownload your repositoriesFalse
-g, --gistsDownload your gistsFalse
-t, --tokenUpdate or set your stored GitHub tokenFalse
--no-archiveDo not create a final .zip archive of the backup folderFalse (archive is created)
--timeout NSet the timeout (in seconds) for each download operation30
--verbosePrint detailed, real-time information about the download processFalse
--shutdownShutdown the computer 60 seconds after the backup finishesFalse
--rebootReboot the computer 60 seconds after the backup finishesFalse

Note: --shutdown and --reboot are mutually exclusive.

What Gets Backed Up?

The tool creates snapshot .zip archives of your code at a specific point in time (without full Git history).

  • Repositories — Saved as [repository-name].zip in the repositories/ folder
  • Gists — Saved as [gist-id].zip in the gists/ folder

File Structure

~/[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, after downloading, the entire folder is compressed into a single .zip file and saved to your home directory. Use --no-archive to skip this step.

Optimizing Download Speed

  • Automatic parallel processing for batches larger than 5 items
  • Worker count = CPU cores minus 1 for optimal performance
  • For large backups (50+ items): use --timeout 120
  • For maximum performance: python app.py -r -g --timeout 180

Handling API Rate Limits

  • Authenticated users have 5,000 requests per hour
  • Automatic exponential backoff on rate limit errors
  • Modify max_workers parameter if needed

Troubleshooting

  • "Failed to authenticate" — Run python app.py -t to update token, ensure repo and gist scopes
  • "Download timeout" — Re-run with higher timeout: --timeout 120
  • "curl" command not found — Install curl: apt install curl (Ubuntu) or equivalent

  • 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 — List of items that couldn't be downloaded
  • Insights & Recommendations — Actionable advice based on backup results

  • Token Storage — GitHub token stored securely at ~/.config/github_repos_downloader/github_token.json
  • No Data Sent Elsewhere — Tool 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

Links


Created by Alexander Suvorov

If you find this useful, please star the repository!