Skip to content

Instantly share code, notes, and snippets.

@potter0815
Last active January 30, 2024 13:07
Show Gist options
  • Star 34 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save potter0815/42dda83fa1709693be36 to your computer and use it in GitHub Desktop.
Save potter0815/42dda83fa1709693be36 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
Copy link

ghost commented Jul 3, 2022

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment