I often need to backup all of my GitHub repositories to a folder. Here is a easy script to make a backup of all your repositories. It clones all of your repositories into a folder with the current date and time.
Save the script as any name you would like. Here is the code:
#!/bin/sh FOLDER=$(date +%B-%d-%Y_%I-%M-%p) rm -rf $FOLDER mkdir $FOLDER cd $FOLDER USER=$1; PAGE=1; curl "https://api.github.com/users/$USER/repos?page=$PAGE&per_page=100" | grep -e 'git_url*' | cut -d \" -f 4 | xargs -L1 git clone
Chmod the script as executable.
Call this script with the argument being your username. Example:
./backupAllRepositories.sh geek1011 This would backup all of my repositories assuming I named the script
I hope you find this useful.