Created
November 11, 2016 15:45
-
-
Save dm/627671b4d209accbcfd92db9ec1d381f to your computer and use it in GitHub Desktop.
Clone all organisation repos into current directory
This file contains hidden or 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 | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| # Create a Personal Access Token and add it here (replace my username with yours) | |
| # https://github.com/settings/tokens | |
| CREDS=dm:TOKEN | |
| ORG=${ORG:=sansible} | |
| PAGES=${PAGES:=60} | |
| for i in $(seq 1 $PAGES); | |
| do | |
| curl -u $CREDS -s "https://api.github.com/orgs/$ORG/repos?page=$i&per_page=100" | ruby -rubygems -e \ | |
| 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment