Created
June 18, 2017 22:14
-
-
Save treelzebub/6145efb698e683183d7bd05f1f08dbdd to your computer and use it in GitHub Desktop.
A script that clones all (public) repos for a github user.
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
#!/bin/bash | |
# Clone all public github repos for the given user. | |
# Assumes SSH key is set up, and that pwd is the directory you want everything cloned in. | |
# | |
# Usage: | |
# $ ./clone-all-repos.sh [github-user-name] | |
if [ -z $1 ]; then | |
printf "A github username is required. Example: $ ./clone-all-repos.sh treelzebub\\n\\n" | |
exit 1 | |
fi | |
curl "https://api.github.com/users/$1/repos?per_page=1000" | grep -o 'git@[^"]*' | xargs -L1 git clone | |
printf "\\n\\nDone.\\n\\n" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment