← Back to Tools
Open Source Tool

GitHub Backup

Bash Disaster Recovery GitHub API

Bash script that snapshots every GitHub repository in your account — public and private. Uses the GitHub API to enumerate repos automatically, clones each one, and compresses to timestamped archives. Run it manually or on a daily cron schedule.

View on GitHub ↗
GitHub is not a backup. If your account is compromised, a repo is deleted, or GitHub has an outage — you need an independent copy. This script makes that copy automatic.

What it does

Quick start

# Clone the repo
git clone https://github.com/mylesagnew/github-backup
cd github-backup

# Set your GitHub token and username
export GITHUB_TOKEN=ghp_your_token_here
export GITHUB_USER=your_username

# Run backup — archives all repos to ./backups/
./backup.sh

# Schedule daily at 3am via cron
# 0 3 * * * /path/to/github-backup/backup.sh >> /var/log/github-backup.log 2>&1

Related resources

Get notified when new tools and checklists drop.

Join Security Tool Updates →