Skip to content

Instantly share code, notes, and snippets.

@treelzebub
Created June 18, 2017 22:14
Show Gist options
  • Save treelzebub/6145efb698e683183d7bd05f1f08dbdd to your computer and use it in GitHub Desktop.
Save treelzebub/6145efb698e683183d7bd05f1f08dbdd to your computer and use it in GitHub Desktop.
A script that clones all (public) repos for a github user.
#!/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