Skip to content

Instantly share code, notes, and snippets.

@organom
Last active July 1, 2018 23:03
Show Gist options
  • Save organom/7ea72ef0f0cb55323cafe7a10d1c0a76 to your computer and use it in GitHub Desktop.
Save organom/7ea72ef0f0cb55323cafe7a10d1c0a76 to your computer and use it in GitHub Desktop.
Clones all the git repos from an organization
#!/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