# Back up all repositories starting with a certain set of characters. # # Replace `/...` with the start of the repo(s) you want to remove. e.g. Jerdak/foo_ gh repo list --json nameWithOwner --jq '.[] | select(.nameWithOwner | startswith("/...")) | .nameWithOwner' | while read -r repo; do owner=$(echo "$repo" | cut -d '/' -f 1) repo_name=$(echo "$repo" | cut -d '/' -f 2) gh repo clone "$owner/$repo_name" cd "$repo_name" tar czf "../${repo_name}.tar.gz" . cd .. rm -rf "$repo_name" done