Skip to content

Instantly share code, notes, and snippets.

@shakhal
Last active July 3, 2019 20:40
Show Gist options
  • Save shakhal/792036e3306df5765d221da3139935b4 to your computer and use it in GitHub Desktop.
Save shakhal/792036e3306df5765d221da3139935b4 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]; then
echo "missing org name"
exit 1
else
name=$1
fi
if [ -z "$2" ]; then
echo "missing token"
exit 1
else
token=$2
fi
cntx="orgs"
page=1
max=4
echo $name
echo $max
echo $cntx
echo $page
until [ ! $page -lt $max ]
do
curl "https://api.github.com/$cntx/$name/repos?page=$page&per_page=100&access_token=$token" | grep -e 'ssh_url*' | cut -d \" -f 4 | xargs -L1 git clone
page=$((page+1))
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment