Skip to content

Instantly share code, notes, and snippets.

@rd2b
Last active December 10, 2015 05:28
Show Gist options
  • Save rd2b/4387863 to your computer and use it in GitHub Desktop.
Save rd2b/4387863 to your computer and use it in GitHub Desktop.
Lists gists and github repositories and clone them from the Github API.
# Set the user:
user="rd2b"
# Lists gists URLS:
curl -s https://api.github.com/users/$user/gists | sed -n 's/.*git_pull_url.*"\(.*\)".*/\1/ p'
# Lists github repositories:
curl -s https://api.github.com/users/$user/repos | sed -n 's/.*clone_url.*"\(.*\)".*/\1/ p'
# Clone all gists :
for i in ` curl -s https://api.github.com/users/$user/gists | sed -n 's/.*git_pull_url.*"\(.*\)".*/\1/ p'`
do
git clone "$i" "gist-$(basename $i)"
done
# Clone all repositories:
for i in `curl -s https://api.github.com/users/$user/repos | sed -n 's/.*clone_url.*"\(.*\)".*/\1/ p'`
do
git clone "$i" "github-$(basename $i)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment