Skip to content

Instantly share code, notes, and snippets.

@fedescarpa
Created January 18, 2018 14:14
Show Gist options
  • Save fedescarpa/2da2a0a828aa420f63933ac1227ada8e to your computer and use it in GitHub Desktop.
Save fedescarpa/2da2a0a828aa420f63933ac1227ada8e to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
GITHUB_USERNAME=$1
GITHUB_ORGANIZATION=$2
if [ -z $USERNAME ] || [ -z $ORGANIZATION ]; then
echo '[ERROR] Missing arguments. Usage: '
echo ''
echo ' clone-repos <GITHUB_USERNAME> <GITHUB_ORGANIZATION>'
echo ''
exit 1
fi
curl -u $GITHUB_USERNAME -s https://api.github.com/orgs/$GITHUB_ORGANIZATION/repos?per_page=500 | ruby -rubygems -e '
require "json"
JSON.load(STDIN.read).each do |repo|
%x[git clone #{repo["ssh_url"]} ]
puts ""
end
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment