Last active
September 11, 2022 15:27
-
-
Save drichardson/4f1e831e0feece632ef4cb179955864c to your computer and use it in GitHub Desktop.
Revisions
-
drichardson revised this gist
Sep 11, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -69,7 +69,7 @@ fi echo Cloning/Updating $ORG Repositories for repo in $(gh repo list $ORG --limit $LIMIT --no-archived --source --json sshUrl -q .[].sshUrl); do echo Cloning $repo base=$(basename $repo) clone_dir=${base%.*} -
drichardson revised this gist
Dec 13, 2021 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,20 @@ #!/bin/bash # Clone/pull every repo you have access to in a github org into a directory. # Source: https://gist.github.com/drichardson/4f1e831e0feece632ef4cb179955864c set -euo pipefail # Max repos to checkout. LIMIT=500 usage() { cat <<-EOF Clone/update all repositories in a GitHub org that you have access to. Clones at most $LIMIT repos. Only source repos (not forks) are cloned. Usage: github-org-up <github_org> <destination> <github_org> is the GitHub organization to use @@ -61,7 +69,7 @@ fi echo Cloning/Updating $ORG Repositories for repo in $(gh repo list $ORG --limit $LIMIT --source --json sshUrl -q .[].sshUrl); do echo Cloning $repo base=$(basename $repo) clone_dir=${base%.*} -
drichardson created this gist
Dec 13, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,80 @@ #!/bin/bash # Clone/pull every repo you have access to in a github org into a directory. set -euo pipefail usage() { cat <<-EOF Clone/update all repositories in a GitHub org that you have access to. Usage: github-org-up <github_org> <destination> <github_org> is the GitHub organization to use <destination> is the directory where all repos will be cloned into. Example: github-org-up . EOF } if [[ $# -eq 0 ]]; then echo Missing github_org. usage exit 1 fi ORG=$1 shift if [[ $# -eq 0 ]]; then echo Missing desination directory. usage exit 1 fi DEST=$1 shift cd "$DEST" if ! hash git; then cat <<-EOF git not installed. Install and try again. EOF fi if ! hash gh; then cat <<-EOF GitHub cli (gh) not installed. Install and try again. If you're using Homebrew, run: brew install gh Otherwise, download here: https://cli.github.com/ EOF exit 1 fi echo Checking GitHub authorization... if ! gh auth status; then # Login instructions already printed. exit 1 fi echo Cloning/Updating $ORG Repositories for repo in $(gh repo list $ORG --source --json sshUrl -q .[].sshUrl); do echo Cloning $repo base=$(basename $repo) clone_dir=${base%.*} if [[ -d $clone_dir ]]; then echo Existing repo found. Pulling into $clone_dir. git -C $clone_dir pull --ff-only & else echo New repo found. Cloning $repo into $clone_dir. git clone --progress $repo & fi done wait echo OK