Backing up a Github repo - tooltwist/documentation GitHub Wiki

To back up a Github repository you need to clone it, and make sure you get all the branches.

For example:

$ cd ~/Desktop/Github-backups
$ git clone https://github.com/twistresources/BinAndWin-phonegap.git
$ cd BinAndWin-phonegap
$ for b in `git branch -r | grep -v -- '->'`; do    git branch --track ${b##origin/} $b; done

Ignore any message like fatal: A branch named 'master' already exists.

$ git fetch --all

You can then ZIP the directory and save it to Google Drive.