ghorg allows you to quickly clone all of an orgs, or users repos into a single directory. This can be useful in many situations including
- Searching an orgs/users codebase with ack, silver searcher, grep etc..
- Bash scripting
- Creating backups
- Onboarding
- Performing Audits
When running ghorg a second time, all local changes in your *_ghorg directory will be overwritten by whats on GitHub. If you are working out of this directory, make sure you rename it before running a second time otherwise all of you changes will be lost.
optional
$ brew update
$ brew upgrade git
required
$ brew install gabrie30/utils/ghorg
$ curl https://raw.githubusercontent.com/gabrie30/ghorg/master/.env-sample > $HOME/.ghorg
$ go get -u github.com/gabrie30/ghorg
$ cd $HOME/go/src/github.com/gabrie30/ghorg
$ cp .env-sample .env
# update your .env, if needed
# If GHORG_GITHUB_TOKEN is not set in .ghorg, defaults to keychain, see below
$ make install
$ go install
$ ghorg org-you-want-to-clone
or
$ ghorg user-you-want-to-clone
ghorg defaults to master branch however, for gitflows you can run on develop by setting GHORG_BRANCH=develop or similar
All configuration will be done in the .ghorg file. This file will be created from the .env-sample and copied into ~/.ghorg
. Make sure this file exists then configure to your needs.
$ security find-internet-password -s github.com | grep "acct" | awk -F\" '{ print $4 }'
If running this does not return the correct key you will need to generate a token via GithHub and add it to your $HOME/.ghorg
To view all other default environment variables see .env-sample
- If org is behind SSO a normal token will not work. You will need to add SSO to the Github token
- Make sure your
$ git --version
is >= 2.19.0 - You may need to increase your ulimits if cloning a large org
- Other issues can most likely be resolved by adding a
.ghorg
to your users home directory and setting the necessary values defined in the.env-sample