Created
December 23, 2023 20:08
-
-
Save SafeEval/0ad07109a273015af0976c54366e0df0 to your computer and use it in GitHub Desktop.
Clone all active (non-archived) repos from an organization.
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 | |
export GITHUB_TOKEN="" | |
export GITHUB_ORG="" | |
gh repo list "$GITHUB_ORG" --no-archived --limit 1000 > repo-list.txt | |
for repo_path in $(cat repo-list.txt | cut -f1); do | |
org="$(echo $repo_path | cut -f1 -d'/')" | |
repo="$(echo $repo_path | cut -f2 -d'/')" | |
if [ ! -d "$repo" ]; then | |
echo "#################################################" | |
echo "$repo: Cloning." | |
git clone "git@github.com:$repo_path"; | |
fi | |
done | |
du -d1 -h | sort -hr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment