Skip to content

Instantly share code, notes, and snippets.

@sofar
Created June 29, 2017 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sofar/088fc688f8d3581acd26a5661cbcaf4a to your computer and use it in GitHub Desktop.
Save sofar/088fc688f8d3581acd26a5661cbcaf4a to your computer and use it in GitHub Desktop.
lists git projects in organization by ssh url
#!/bin/bash
ORG="$1"
while true; do
((PAGE++))
URL="https://api.github.com/users/$ORG/repos?per_page=20"
if [ $PAGE -gt 1 ]; then
URL="$URL&page=$PAGE"
fi
NEW=( `curl -i "$URL" | grep ssh_url | cut -d'"' -f4 `)
LIST=( ${LIST[@]} ${NEW[@]} )
if [ ${#NEW[@]} -lt 20 ]; then
break
fi
done
for E in ${LIST[@]}; do
echo $E
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment