Last active
July 3, 2023 08:36
-
-
Save shedali/a5cbbe8dfc95795b93d7a239af22d023 to your computer and use it in GitHub Desktop.
clone all org repos
This file contains hidden or 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
export GITHUB_TOKEN=$(op plugin run gh auth token) | |
for org in $(gh org list); do | |
o=${org} | |
/usr/local/bin/op plugin run -- gh repo list $o --json name -q '.[] | .name' | while read -r repo; do | |
dir=$o/$repo | |
echo $dir | |
if [ -d "$dir" ]; then | |
(cd $dir && git stash --all && gh repo sync && git stash pop) | |
else | |
gh repo clone $dir $dir | |
fi | |
done; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment