Skip to content

Instantly share code, notes, and snippets.

@Phelan164
Forked from potter0815/cloneall.sh
Created September 1, 2021 12:11
Show Gist options
  • Save Phelan164/d215f6716951a0faa1d1a62f45cf29a6 to your computer and use it in GitHub Desktop.
Save Phelan164/d215f6716951a0faa1d1a62f45cf29a6 to your computer and use it in GitHub Desktop.
clone all private repos of an organization
#!/bin/bash
#requires jq -> http://stedolan.github.io/jq/
#optional change working_dir
working_dir=${1-$(pwd)}
cd $working_dir
user="github_username"
token="application token"
organization="Organization_Name"
repo_list=$(curl https://api.github.com/orgs/$organization/repos?type=private\&per_page=100 -u ${user}:${token} | jq .[].ssh_url | sed -e 's/^"//' -e 's/"$//')
for repo in $repo_list
do
echo "Repo found: $repo"
git clone $repo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment