Last active
October 19, 2021 12:46
-
-
Save sandipndev/b08c546e5b055b3b9e3bbed8bccd0b8e to your computer and use it in GitHub Desktop.
Here's your safety pin. All your repositories via an Access Token!
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 | |
# Organization Name | |
echo -n "Enter Organization Slug: " | |
read ORG | |
# Access Token | |
echo -n "Enter GitHub Access Token: " | |
read GH_ACCESS_TOKEN | |
# Downloading and parsing the list of ssh clone urls | |
curl -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${GH_ACCESS_TOKEN}" https://api.github.com/orgs/${ORG}/repos?per_page=100 | jq --raw-output -c '.[].full_name?' > repos | |
# Download each repo | |
while IFS= read -r repo; do | |
git clone https://$GH_ACCESS_TOKEN:x-oauth-basic@github.com/$repo | |
done < repos | |
# Cleanup | |
rm repos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice