GitHub Repositories Backup Tools

Professional solution for automatic cloning and backup of all your GitHub repositories

Fast and full modes, token authentication, automatic retries, detailed reports.


A professional solution for automatic cloning and backup of all your GitHub repositories.

You can also use my other projects to work with repositories:

  • Full Backup — clones ALL repositories (public and private) from your account and organizations
  • Smart Update — compares local commits with GitHub, updates only when needed
  • Automatic Retries — up to 5 attempts with exponential backoff on failures
  • Health Check — automatic integrity verification of each repository
  • No SSH Required — uses only HTTPS with token authentication
  • Token Persistence — token is saved after first use and reused on subsequent runs
  • Progress with Error Counter — visual progress bar showing current/total/errors
  • Detailed Report — statistics on cloned/updated/synced/skipped/failed repositories
  • User Profile Export — saves GitHub user information to user_info.json
  • Branch Pruning — automatically removes local branches deleted on remote (Full Mode)
  • Organized Backups — all archives and reports stored in backups/ folder
  • Power Management — shutdown/reboot after completion (optional)
  • Fast Mode (Default) — clones only default branch for maximum speed
  • Full Mode--all-branches flag to enable synchronization of ALL branches

Fast Mode (Default)python app.py -r

  • CLONE — new repository, full clone (all branches on first clone)
  • PULL — has changes, updates only code in current branch
  • SKIP — no changes, skips the repository

Full Modepython app.py -r --all-branches

  • CLONE — new repository, full clone (all branches)
  • PULL — has changes, updates code + all branches
  • SYNC — no changes, only syncs branches (fetch + create local branches)
  • CLONE (recover) — fetch failed, re-clones the repository

Installation

git clone https://github.com/smartlegionlab/github-repos-backup-tools.git
cd github-repos-backup-tools

First Run

python app.py -r

Commands

  • -r — Clone/update repositories
  • -t — Update token (delete old and request new)
  • --no-archive — Disable archive creation
  • --timeout N — Timeout for Git operations (default: 30)
  • --all-branches — Enable full branch synchronization
  • --shutdown — Shutdown computer after completion
  • --reboot — Reboot computer after completion

~/github_repos_backup_tools/              # Main application folder
└── username/                              # Your GitHub username
    ├── repositories/                       # All cloned repositories
    │   ├── repo1/
    │   ├── repo2/
    │   └── ...
    ├── backups/                            # All backup artifacts
    │   ├── backup_report_*.json
    │   └── username_github_backup_*.zip
    ├── config.json                          # Token file
    └── user_info.json                       # Your GitHub profile information

  • Language: Python 3.8+
  • Git: GitPython
  • API: GitHub API v3/v4
  • Platform: Windows / Linux / macOS
  • License: BSD 3-Clause

Links


Created by Alexander Suvorov Sr.

Star this repo if you find it useful!

Python CLI GitHub API Backup Cross-Platform Automation