Skip to content

Instantly share code, notes, and snippets.

@nighthawk24
Forked from anonymous/gh-backup-starred.sh
Created February 8, 2017 19:19
Show Gist options
  • Save nighthawk24/9bbaae7ed24c6ed9fc0d6e7bdc525b09 to your computer and use it in GitHub Desktop.
Save nighthawk24/9bbaae7ed24c6ed9fc0d6e7bdc525b09 to your computer and use it in GitHub Desktop.
Backup starred GitHub repositories
#!/bin/bash
user="CHANGEME"
pages=$(curl -I https://api.github.com/users/$user/starred | sed -nr 's/^Link:.*page=([0-9]+).*/\1/p')
for page in $(seq 0 $pages); do
curl "https://api.github.com/users/$user/starred?page=$page&per_page=100" | jq -r '.[].html_url' |
while read rp; do
git clone $rp
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment