Last active
July 24, 2020 19:40
-
-
Save ChrisPritchard/929172610aae3f47e2ac1aaa804ccac0 to your computer and use it in GitHub Desktop.
A simple script that will clone all public *and* private repos the user owns (no forks!) and zip up the results.
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
#!/bin/bash | |
# Author: Chris Pritchard (github.com/ChrisPritchard) | |
# requires jq, 7z and git be installed | |
# run as ./cloner.sh [personal access token] [UserName] | |
REPOS=$(curl -s -H "Authorization: token $1" "https://api.github.com/user/repos?&affiliation=owner&per_page=200" | jq -r '.[] | select(.fork==false) | .full_name') | |
rm -rf ./temp-cloner | |
mkdir temp-cloner | |
for REPO in $REPOS; do | |
git clone -q "https://github.com/$REPO" temp-cloner/$REPO | |
done | |
7z a github.zip "./temp-cloner/$2/*" | |
rm -rf ./temp-cloner |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment