Skip to content

Instantly share code, notes, and snippets.

@jsok
Created September 14, 2015 00:31
Show Gist options
  • Save jsok/bc5fb8eab95535bc7e8d to your computer and use it in GitHub Desktop.
Save jsok/bc5fb8eab95535bc7e8d to your computer and use it in GitHub Desktop.
Clone all repositories of an organisation
#!/bin/bash
set -e
# Usage:
# ORG=MyOrg OAUTH_TOKEN=token ./clone.sh
SSH_FILTER=".[] | .ssh_url"
REPOS=$(curl -s -H "Authorization: token ${OAUTH_TOKEN}" https://api.github.com/orgs/$ORG/repos | jq -r "$SSH_FILTER")
for repo in $REPOS; do
echo "=> Cloning $repo..."
git clone $repo
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment