Skip to content

Instantly share code, notes, and snippets.

@hadrienblanc
Created April 5, 2024 10:17
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 hadrienblanc/09af82a33a1f9a0052c34299e6cf712d to your computer and use it in GitHub Desktop.
Save hadrienblanc/09af82a33a1f9a0052c34299e6cf712d to your computer and use it in GitHub Desktop.
#!/bin/bash
brew install jq
ORG="xxxx"
TOKEN="xxxx" # 30 days valid
# Ensure jq and curl are installed
REPOS=$(curl -H "Authorization: token $TOKEN" "https://api.github.com/orgs/${ORG}/repos?per_page=100&type=all" | jq -r '.[].clone_url')
for REPO in $REPOS; do
# Replace the HTTPS scheme with one that includes the token for authentication
CLONE_URL=$(echo $REPO | sed "s/https:\/\//https:\/\/$TOKEN@/")
git clone $CLONE_URL
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment