Skip to content

Instantly share code, notes, and snippets.

@ixth
Created March 8, 2022 22:19
Show Gist options
  • Save ixth/c8e0ef49b19c4fc3b4c16cca1fe98cfd to your computer and use it in GitHub Desktop.
Save ixth/c8e0ef49b19c4fc3b4c16cca1fe98cfd to your computer and use it in GitHub Desktop.
Backup GitHub Repos
PAGE=0
while true; do
PAGE=$(($PAGE + 1))
REPOS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/user/repos?visibility=all&page=$PAGE" | jq -r '.[].ssh_url')
if [ -z "$REPOS" ]; then
break;
fi
for REPO in $REPOS; do
git clone --no-checkout "$REPO"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment