Created
October 12, 2021 07:43
-
-
Save lemieszek/d12cec87844fbf43de026eda13da3945 to your computer and use it in GitHub Desktop.
Get all repos from GitHub user or org
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
# Auth token is optional | |
# Get user repos | |
NAME="username"; PAGE=1; TOKEN="your_personal_token"; | |
curl -H "Authorization: token $TOKEN" "https://api.github.com/users/$NAME/repos?page=$PAGE&per_page=100" | | |
grep -e 'git_url*' | | |
cut -d \" -f 4 | | |
xargs -L1 git clone | |
# Get org repos | |
NAME="orgname"; PAGE=1; TOKEN="your_personal_token"; | |
curl -H "Authorization: token $TOKEN" "https://api.github.com/orgs/$NAME/repos?page=$PAGE&per_page=100" | | |
grep -e 'git_url*' | | |
cut -d \" -f 4 | | |
xargs -L1 git clone | |
# use sed to change it to ssh clone | |
sed 's/git:\/\//git@/g' | | |
sed 's/github.com\//github.com:/g' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment