Created
October 25, 2025 20:19
-
-
Save yetanotherchris/47f0f43c5ac08eac9b9974393ff565fd to your computer and use it in GitHub Desktop.
Backup all your Github repositories script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # View all your repos: | |
| (iwr https://api.github.com/users/yetanotherchris/repos?per_page=1000).Content | jq '.[].html_url' | |
| # Get all repositories (including private ones) using gh cli | |
| # The gh cli handles authentication and paging automatically, and private repos | |
| $repos = gh repo list yetanotherchris --limit 1000 --json nameWithOwner,sshUrl | ConvertFrom-Json | |
| # Clone each repository | |
| foreach ($repo in $repos) { | |
| Write-Host "Cloning $($repo.nameWithOwner)..." -ForegroundColor Green | |
| gh repo clone $repo.nameWithOwner | |
| } | |
| # Now zip up the folders + upload to your favourite S3 provider |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment