Skip to content

Instantly share code, notes, and snippets.

@seajaysec
Forked from anonymous/gh-backup-starred.sh
Last active January 25, 2024 22:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seajaysec/36ddf50db480fe412b8eceadef64cafc to your computer and use it in GitHub Desktop.
Save seajaysec/36ddf50db480fe412b8eceadef64cafc 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')
cd /opt/
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 --recurse-submodules -j8 $rp
done
done
@seajaysec
Copy link
Author

Modified the original to include --recurse-submodules -j8 to account for repos with submodules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment