Skip to content

Instantly share code, notes, and snippets.

@kevalpatel2106
Last active April 5, 2018 07:13
Show Gist options
  • Save kevalpatel2106/f0eea38bbb357ceb51842717c5b91333 to your computer and use it in GitHub Desktop.
Save kevalpatel2106/f0eea38bbb357ceb51842717c5b91333 to your computer and use it in GitHub Desktop.
Clone all the repo from Github.
#!/bin/bash
echo "Enter the access key. Tou can generate access key from \"https://github.com/settings/tokens\".:"
read ACCESS_TOKEN
echo "Enter to host url of the GitHub: (e.g. github.com)"
read GITHUB_INSTANCE
echo "Enter to the page number: (Script will download 100 repos per page.)"
read PAGE
echo "Gtihub username:"
read USERNAME
CNTX="user"
curl -H "Authorization: token ${ACCESS_TOKEN}" "https://api.${GITHUB_INSTANCE}/$CNTX/repos?type=owner&page=$PAGE&per_page=100" |
grep -e 'clone_url*' |
cut -d \" -f 4 |
sed "s/${GITHUB_INSTANCE}/${USERNAME}@${GITHUB_INSTANCE}/g" |
xargs -L1 git clone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment