Skip to content
Quickly clone an entire GitHub Org into one directory
Branch: master
Clone or download
Latest commit 596f370 Dec 8, 2018


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.




$ brew update
$ brew upgrade git


$ brew install gabrie30/utils/ghorg
$ curl > $HOME/.ghorg


$ go get -u
$ cd $HOME/go/src/
$ 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


$ 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.

Default GitHub Token Used

$ security find-internet-password -s  | 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


  • 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

You can’t perform that action at this time.