-
-
Save nilkesede/ab6c3c21302f7a51284d97400597baab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Clone all github.com repositories for a specified user/organization. | |
if [ $# -eq 0 ] | |
then | |
echo "Usage: $0 <type>(me|users|orgs) <user_name>" | |
exit; | |
fi | |
type=$1 | |
user=$2 | |
token="" # Your personal token here | |
url="https://api.github.com/$type/$user/repos?per_page=1000" | |
if [ $type == 'me' ] | |
then | |
url="https://api.github.com/user/repos?type=owner&per_page=999" | |
fi | |
for repo in `curl --location --request GET $url --header "Authorization: Basic ${token}" |grep ssh_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/'`;do | |
git clone $repo; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment