Created
April 5, 2024 10:17
-
-
Save hadrienblanc/09af82a33a1f9a0052c34299e6cf712d to your computer and use it in GitHub Desktop.
This file contains 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 | |
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