Skip to content

Instantly share code, notes, and snippets.

@vke-code
Created September 12, 2018 21:39
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 20 You must be signed in to fork a gist
  • Save vke-code/fda27b3ae617e733f3d28e939caee22f to your computer and use it in GitHub Desktop.
Save vke-code/fda27b3ae617e733f3d28e939caee22f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Clone all github.com repositories for a specified user.
if [ $# -eq 0 ]
then
echo "Usage: $0 <user_name> "
exit;
fi
USER=$1
# clone all repositories for user specifed
for repo in `curl -s https://api.github.com/users/$USER/repos?per_page=1000 |grep git_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/'`;do
git clone $repo;
done;
@A-Makeyev
Copy link

#!/bin/bash

This BASH script clones all github.com repositories for a specified user!

HOW TO USE THE SCRIPT:

CD to the directory where you want to download all the repositories (or open terminal there)

then execute the script by defining the path to where you saved the .sh file, followed by your Github username:

"sh the/path/to/download-all-repos.sh <github_user_name_here>"

Then hit RETURN and watch the magic happen

if [ $# -eq 0 ]
then
echo "ERROR: Github username is missing, you shoud type THIS in your terminal: "
echo "$0 <github_user_name_here> "
exit;
fi

USER=$1

clone all repositories for specified user:

for repo in curl -s https://api.github.com/users/$USER/repos?per_page=1000 |grep clone_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/';do
git clone $repo;
done;

Dam thats awesome thanks

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