Skip to content

Instantly share code, notes, and snippets.

@coderxin
Created November 17, 2023 14:47
Show Gist options
  • Save coderxin/25c0920384e0fb1feae3135f4b2d9a84 to your computer and use it in GitHub Desktop.
Save coderxin/25c0920384e0fb1feae3135f4b2d9a84 to your computer and use it in GitHub Desktop.
# Utility to clone all non-achived Git repos from Organisation
# - Clone only if target folder does not exist
gh repo list CHANGE_ORG_NAME --no-archived --limit 1000 | while read -r repo _; do
DIRECTORY=$(echo "$repo" | cut -d "/" -f 2)
if [ ! -d "$DIRECTORY" ]; then
echo "$DIRECTORY does not exist."
gh repo clone "$repo" "$DIRECTORY"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment