Batch archive or unarchive multiple GitHub repositories with maximum clarity, safety, and speed.
curl -sSL https://raw.githubusercontent.com/Paul1404/gh-batch-archive/main/gh-batch-archive.sh | bash- Batch archive or unarchive any number of repositories
- Interactive selection (with fzf), or fallback to a simple menu
- Pattern filtering to quickly narrow down your repo list
- Dry-run mode for safe previews
- Parallel processing for speed
- Clear, explicit, and colorful messaging at every step
- Action logging for auditability
- No external dependencies except GitHub CLI (
gh).
(fzf is optional for best UX)
-
Clone this repository:
git clone https://github.com/Paul1404/gh-batch-archive.git cd gh-batch-archive -
Make the script executable:
chmod +x gh-batch-archive.sh
-
Authenticate with GitHub CLI (if you haven't already):
gh auth login
-
Run the script!
./gh-batch-archive.sh
./gh-batch-archive.sh [options] [owner_or_org]| Option | Description |
|---|---|
--unarchive |
Unarchive instead of archive |
--dry-run |
Show what would be done, but don't change anything |
--pattern |
Filter repos by substring or regex (e.g. --pattern "test") |
--interactive |
Use interactive selection (fzf if available, fallback to menu) |
--parallel N |
Process up to N repos in parallel (default: 4) |
--log FILE |
Log actions to FILE (default: gh-batch-archive.log) |
--help |
Show help message |
-
Archive all your repositories:
./gh-batch-archive.sh
-
Archive all repositories for an organization:
./gh-batch-archive.sh myorg
-
Interactively select which repos to archive:
./gh-batch-archive.sh --interactive
-
Filter by pattern and archive:
./gh-batch-archive.sh --pattern "test" -
Unarchive repositories (instead of archiving):
./gh-batch-archive.sh --unarchive
-
Preview what would happen (dry-run):
./gh-batch-archive.sh --dry-run
-
Process 8 repos in parallel:
./gh-batch-archive.sh --parallel 8
If you have fzf installed, you can interactively select multiple repositories with your keyboard.
If not, the script will fall back to a simple numbered menu.
All actions (including dry-runs) are logged to gh-batch-archive.log by default.
You can specify a different log file with --log myfile.log.
- Dry-run mode (
--dry-run) lets you preview actions before making changes. - Explicit confirmation is required before any changes are made.
- Clear summary of what will happen is shown before proceeding.
- GitHub CLI (
gh) (required) - fzf (optional, for best interactive experience)
- Bash 4.x or later
Pull requests and suggestions are welcome!
Feel free to open an issue or submit a PR.
This tool was built to make mass archiving and unarchiving of GitHub repositories safe, fast, and transparent for individuals and organizations.