Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 2.97 KB

README.md

File metadata and controls

83 lines (56 loc) · 2.97 KB

ghorg

Go Report Card GoDoc Awesome License

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

  1. Searching an orgs/users codebase with ack, silver searcher, grep etc..
  2. Bash scripting
  3. Creating backups
  4. Onboarding
  5. 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.

Setup

Homebrew

optional

$ brew update
$ brew upgrade git

required

$ brew install gabrie30/utils/ghorg
$ curl https://raw.githubusercontent.com/gabrie30/ghorg/master/.env-sample > $HOME/.ghorg

Golang

$ 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

Use

$ 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

Configuration

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.

Default GitHub Token Used

$ 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

Auth through SSO

  • If org is behind SSO a normal token will not work. You will need to add SSO to the Github token

Troubleshooting

  • 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

Updating brew tap