Skip to content

Instantly share code, notes, and snippets.

@pataiji
Last active July 5, 2022 02:23
Show Gist options
  • Save pataiji/6d4bc66651c96eeccd1e47cbe4b5f3eb to your computer and use it in GitHub Desktop.
Save pataiji/6d4bc66651c96eeccd1e47cbe4b5f3eb to your computer and use it in GitHub Desktop.
Clone multiple repositories
#!/bin/bash
repos=$(gh repo list hoge_org \
--no-archived \
--limit 1000 \
--json name \
--jq '.[].name')
for repo in $repos;
do
if [[ ! -d $repo ]]; then
git clone git@github.com:hoge_org/$repo
fi
done
gh repo list hoge_org \
--no-archived \
--limit 1000 \
--json sshUrl \
--jq '.[].sshUrl | select(contains("hoge_org/fuga"))' \
| xargs -I{} git clone {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment