Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Created March 30, 2017 00:38
Show Gist options
  • Select an option

  • Save KensoDev/693e333c65801b49e27bbb4223466108 to your computer and use it in GitHub Desktop.

Select an option

Save KensoDev/693e333c65801b49e27bbb4223466108 to your computer and use it in GitHub Desktop.
all:
force:
token=<your-github-token>
user=<your-github-username>
org=<your-github-organization>
auth_opt=-u $(user):$(token)
# note: not all repos are in there! hitting the page limit of 30.
x.repos.json: force
curl -Ks $(auth_opt) https://api.github.com/orgs/$(org)/repos?per_page=100 \
> $@
clone-all: x.repos.json
cat x.repos.json \
| jq -M -r '.[]|.ssh_url' \
| while read url; do (test -e $$(echo $$url | sed 's|.*/\(.*\)\.git|\1|') || git clone $$url ); done
list-all: x.repos.json
cat x.repos.json \
| jq -M -r '.[]|.ssh_url' \
| while read url; do (echo $$url); done
pull-all:
for d in ./*; do echo $$d; (cd $$d; git pull); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment