Skip to content

Instantly share code, notes, and snippets.

@dinklebrow
Created September 1, 2019 11:34
Show Gist options
  • Select an option

  • Save dinklebrow/26893dc64a95858064942bc0715581a0 to your computer and use it in GitHub Desktop.

Select an option

Save dinklebrow/26893dc64a95858064942bc0715581a0 to your computer and use it in GitHub Desktop.
Get all repos from a GIT user.
#!/bin/bash
# Gets all the repos from a user.
# Limited error checking. Well even less than that.
# Orginal info taken from:
# https://blog.scottlowe.org/2018/07/19/cloning-all-repositories-in-a-github-organization/
# Usage: getAllRepos.sh.sh {$USER}
# E.g: getAllRepos.sh.sh dinklebrow
# Set GITUSER to the first argument.
GITUSER=$1
#Create User directory if not exist.
if [ -d $GITUSER -a ! -h "$GITUSER" ]
then
echo "[*] $GITUSER Directory Exist!"
else
echo "[!] Directory Does not exist!."
echo "[*] Creating Directory."
mkdir $GITUSER
fi
#Lets change into the GITUSER folder.
cd $GITUSER
# Lets curl this bitch and put it in the new folder.
curl -s https://api.github.com/users/$GITUSER/repos?per_page=200 | jq -r '.[].clone_url' | xargs -n 1 git clone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment