Skip to content
forked from gabrie30/ghorg

Quickly clone an entire GitHub org into one directory

License

Notifications You must be signed in to change notification settings

t0mmynguyen/ghorg

 
 

Repository files navigation

ghorg

Go Report Card GoDoc Awesome License

ghorg allows you to quickly clone all of an orgs repos into a single directory. This can be useful in many situations including

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

ghorg defaults to master however, for gitflows you can run on develop by setting GHORG_BRANCH=develop or similar

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

About

Quickly clone an entire GitHub org into one directory

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.4%
  • Makefile 1.6%