Last active
July 1, 2018 23:03
-
-
Save organom/7ea72ef0f0cb55323cafe7a10d1c0a76 to your computer and use it in GitHub Desktop.
Clones all the git repos from an organization
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 | |
if [ $# -lt 2 ] | |
then | |
echo "No arguments supplied" | |
echo "USAGE: $0 {organization} {accesstoken}" | |
echo "" | |
else | |
organization=$1 | |
acesstoken=$2 | |
for (( i=1; i<=10; i++)) | |
do | |
curl -s "https://api.github.com/orgs/$organization/repos?per_page=100&page=1&access_token=$accesstoken" | jq .[].ssh_url >> gitrepos | |
done | |
mkdir $organization && cd $organization | |
cat ../gitrepos | xargs -L1 git clone | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment