-
-
Save Hackdemon23/a2ef2ae86477dad632a289be9bd8d599 to your computer and use it in GitHub Desktop.
Quick clone all org repos using Github Enterprise API v3
This file contains 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
#!/usr/bin/env bash | |
prefix_url='https://github......' | |
declare -a groups=( | |
"my" | |
"org" | |
"groups" | |
) | |
CWD=$(pwd) | |
WORKDIR=${HOME}/workspace | |
mkdir -p ${WORKDIR} | |
cd ${WORKDIR} | |
for group in "${groups[@]}" | |
do | |
repos=$(wget -q --no-check-certificate ${prefix_url}/api/v3/orgs/${group}/repos -O- | jq -r '.[].name') | |
mkdir -p ${group} | |
cd ${group} | |
while read -r repo; do | |
if [[ ! -d ${repo} ]]; then | |
git clone ${prefix_url}/${group}/${repo}.git | |
fi | |
done <<< "${repos}" | |
cd ${WORKDIR} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment