-
-
Save masterxavierfox/36aaafa2118916030171722b7af7aa9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Copyright 2011, Tim Branyen @tbranyen <[email protected]> | |
| # Dual licensed under the MIT and GPL licenses. | |
| # | |
| # github.sh : Automatically clone multiple repos into a folder, | |
| # great for setting up a git projects folder. | |
| # Override these with your own values | |
| USERNAME=tbranyen | |
| [email protected]: | |
| # All arguments | |
| args=$* | |
| # Find each repo and pull from github | |
| for repo in $args; do | |
| # If a user provides the parameter username/repo pull in that specific repository. | |
| if [ `awk -v a="$repo" -v b="/" 'BEGIN{print index(a,b)}'` ]; then | |
| echo "Pulling in $repo"; | |
| git clone $GITHUB_PREFIX$repo.git | |
| # Use the default user specified. | |
| else | |
| echo "Pulling in $USERNAME/$repo"; | |
| git clone $GITHUB_PREFIX$USERNAME/$repo.git | |
| fi | |
| done | |
| # Usage: | |
| # Configure the USERNAME variable | |
| # Automatically clone multiple repos into a folder, great for setting up a git projects folder. | |
| # ./github repo1 repo2 repo3 | |
| # | |
| # | |
| # TODO: | |
| # * Error checking and fallbacks | |
| # * Automatically pull github username from GIT | |
| # vim: ts=2:sw=2:sts=2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment