Clones every repository or gist from a Github user, optionally to a specified directory.
clone-all(1) is perfect to help you set up a new computer, back up your Github account, or if you just want to grab all of a users public repositories. It also goes great with an OS X setup script or dotfiles setup.
- Git and Github account
- Homebrew (for package installation of the following)
- jq (for JSON to bash manipulation)
- roundup (for testing)
clone-all(1) is a shell script, so installation is simple. Download, extract and copy the script in the bin
directory over to the /usr/local/bin
directory and make sure it's in your $PATH
. The man page, man clone-all
, can be installed by copying over the clone-all.1
file to /usr/share/man/man1
.
$ bash -c "$(curl -fsSL raw.github.com/iamnewton/clone-all/go/install)"
N.B. - using the one-line installation will download and install all of the dependencies, including the man page.
$ clone-all [options] <github_username> [<path>]
Flag | Meaning |
---|---|
-h, --help |
Print out help text |
-f, --feed <value> |
<value> can be either gists or repos , default is repos |
-v, --version |
Print out version |
N.B. - Default <path>
is $HOME/Downloads
.
Inspiration and code was taken from many sources, but mostly from StackOverflow:
- Handling positional parameters
- How to get the latest tag name in current branch in Git?
- How to add a progress bar to a shell script?
- How to increment a variable in bash?
- Other Comparison Operators
- The Basics of Using the Sed Stream Editor to Manipulate Text in Linux
- sed, a stream editor
- bash: replace an entire line in a text file
- In bash, how do I convert a space-delimited string into an array?
- Returning Values from Bash Functions
- Github API pagination via curl
- How to check if a program exists from a bash script?