#!/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
# set user var
GITHUB_USER=$1
# clone all repos into github user dir
mkdir $GITHUB_USER && \
cd $GITHUB_USER && \
for repo in `curl -s https://api.github.com/users/$GITHUB_USER/repos?per_page=1000 | grep clone_url | awk '{print $2}'| sed 's/"\(.*\)",/\1/'`;do
git clone $repo;
done;
First, how to get all
GitHub
user's repos:References: