Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Created October 25, 2025 20:19
Show Gist options
  • Save yetanotherchris/47f0f43c5ac08eac9b9974393ff565fd to your computer and use it in GitHub Desktop.
Save yetanotherchris/47f0f43c5ac08eac9b9974393ff565fd to your computer and use it in GitHub Desktop.
Backup all your Github repositories script
# 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