GitHub Repositories Backup Tools
Professional solution for automatic cloning and backup of all your GitHub repositories
Full backup of public and private repositories, smart updates, automatic retries, and detailed reports.
github-repos-backup-tools — a professional solution for automatic cloning and backup of all your GitHub repositories. Full backup of public and private repositories, smart updates, automatic retries, and detailed reports.
You can also use my other projects to work with repositories:
- Smart Repository Manager GUI — Desktop application for managing GitHub repositories with intelligent synchronization and visual management tools
- Smart Repository Manager CLI — Comprehensive command-line tool for managing GitHub repositories
- Smart Repository Manager Core — Python library for managing Git repositories with GitHub integration
- 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-branchesflag 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 Mode — python 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
~/github_repos_backup_tools/ # Main application folder
└── username/ # Your GitHub username
├── repositories/ # All cloned repositories
│ ├── repo1/ # Repository copy
│ ├── repo2/
│ └── ...
├── backups/ # All backup artifacts
│ ├── backup_report_2026-02-28_15-30-45.json
│ └── username_github_backup_2026-02-28_15-30-45.zip
├── config.json # Token file (automatically created)
└── user_info.json # Your GitHub profile information
- Python: 3.8+ (standard library only, no external dependencies)
- Git: 2.20+
- Storage: depends on repository sizes
- Network: stable internet connection
1. Installation:
git clone https://github.com/smartlegionlab/github-repos-backup-tools.git cd github-repos-backup-tools
2. First Run:
python app.py -r
On first run, the program will ask for your GitHub token and save it.
3. Get GitHub Token:
- Go to GitHub Tokens
- Select permissions:
repo(full repository access),read:org(access to organization repositories) - Generate and copy the token
| Command | Description |
|---|---|
-r | Clone/update repositories |
-t | Update token (delete old and request new) |
--no-archive | Disable archive creation (archive is created by default) |
--timeout N | Timeout for Git operations in seconds (default: 30) |
--all-branches | Enable full branch synchronization (slower, clones ALL branches) |
--shutdown | Shutdown computer after completion |
--reboot | Reboot computer after completion |
Usage Examples:
# Fast mode - only default branch (DEFAULT) python app.py -r # Full mode - ALL branches (slower but complete) python app.py -r --all-branches # Backup without archive python app.py -r --no-archive # With increased timeout python app.py -r --timeout 60 # Update token python app.py -t # Backup with shutdown python app.py -r --shutdown
Operation Modes:
| Mode | Command | Behavior | Use Case |
|---|---|---|---|
| Fast (Default) | python app.py -r | Code only, default branch after clone | Quick daily sync |
| Full | python app.py -r --all-branches | Full backup with ALL branches + sync | Complete backup |
Status Meanings in Logs:
| Status | Mode | Meaning |
|---|---|---|
| CLONE | Both | New repository - full clone |
| PULL | Fast | Code update (current branch only) |
| PULL | Full | Code + all branches update |
| SKIP | Fast | Skipped - no changes |
| SYNC | Full | Branch sync only - code hasn't changed |
| CLONE (recover) | Full | Re-clone on error |
Update Logic:
- Quick check: compare local commit date with GitHub pushed_at
- If difference > 5 minutes: compare actual commit hashes via
ls-remote - If hashes differ: perform
git pull - After pull: verify repository health with
git rev-parse HEAD - If corrupted: automatic re-clone with retries
- Token stored in
~/github_repos_backup_tools/[username]/config.json - Uses HTTPS with token in URL (not transmitted in plain text)
- Path traversal attack protection
- No telemetry or third-party data transmission
- Token can be updated with
-tcommand - Archives contain ONLY repositories, no tokens or configs
- Gists not supported — utility works with repositories only
- Git required — must be installed on the system
- Token permissions — requires
repoandread:org
- Q: Authentication fails?
- Verify token has
repoandread:orgpermissions. Use-tto update. - Q: Clone timeout?
- Increase timeout:
--timeout 60 - Q: Where is token stored?
- In
~/github_repos_backup_tools/[username]/config.json - Q: Where are backups stored?
- All archives and reports are in
~/github_repos_backup_tools/[username]/backups/ - Q: What's in user_info.json?
- Your GitHub profile information - login, name, email, repo counts, followers, etc.
- Q: How to cancel scheduled shutdown?
shutdown -c(Linux/macOS) orshutdown /a(Windows)
- User profile export — saves GitHub user info to
user_info.json - Organized backups — all archives and reports in
backups/folder - Cleaner archives — ZIP contains only repositories, no configs or tokens
- Improved structure —
~/github_repos_backup_tools/[username]/backups/ - Branch pruning — automatically removes local branches deleted on remote
- No SSH required — uses only HTTPS with token authentication
- Smart update — two-stage verification (date + hash) before pull
- Health checks — verifies repository integrity after each operation
- Automatic recovery — re-clones corrupted repositories
- Exponential backoff — up to 5 retries with increasing delays
- Two operation modes — Fast (default) and Full (
--all-branches)
******************************************************************************** ----------------------- GitHub Repositories Backup Tools ----------------------- 🔧 Arguments Parsing: Backup: Repositories, Archive Timeout: 30s Branches: ⚡ Fast mode (default branch only) Power: ❌ No action 🔐 GitHub Authentication Found existing user: smartlegionlab ✅ Authenticated as: smartlegionlab 🔍 Scanning repositories... ✅ Found 52 repositories 📁 Backup location: /home/user/github_repos_backup_tools/smartlegionlab [██████████████████████████████] 100.0% | 52/52/0 | SKIP | smartlegionlab/repo ✅ Repository processing complete! ============================================================ 📋 BACKUP REPORT ============================================================ 👤 User: smartlegionlab ⏱️ Duration: 0:05:18 📊 REPOSITORY STATISTICS: Total: 52 repositories ⏭️ Skipped: 52 repositories (no changes) ❌ Failed: 0 repositories ✅ Success rate: 100.0% ============================================================📦 Archive created: smartlegionlab_github_backup_2026-02-27_17-24-20.zip 📊 Size: 15.19 MB ------------------------------------------------------------------------------------ ----------------------- Copyright © 2026, Alexander Suvorov ------------------------ ************************************************************************************
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
Links
Created by Alexander Suvorov Sr.
Copyright © 2026, Alexander Suvorov