2019-07-25 20:42:06 -07:00
2019-07-25 20:33:58 -07:00
2018-06-07 19:22:58 -07:00
2019-07-25 20:33:58 -07:00
2018-03-29 21:07:01 -07:00
2019-07-25 20:42:06 -07:00
2018-06-09 09:11:24 -07:00
2018-06-09 09:17:37 -07:00
2018-06-07 20:27:36 -07:00
2018-05-20 19:41:43 -07:00
2019-07-25 20:33:58 -07:00
2019-07-25 20:33:58 -07:00
2019-07-25 20:33:58 -07:00
2019-07-25 20:33:58 -07:00

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
$ mkdir -p $HOME/ghorg
$ curl https://raw.githubusercontent.com/gabrie30/ghorg/master/sample-conf.yaml > $HOME/ghorg/conf.yaml

Golang

$ go get -u github.com/gabrie30/ghorg
$ cd $HOME/go/src/github.com/gabrie30/ghorg
$ make install
# Update conf if neeed
$ vi ~/ghorg/conf.yaml
$ go install

Use

$ ghorg clone org-you-want-to-clone
$ ghorg clone user-you-want-to-clone
$ ghorg clone --help

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

Configuration

Configuration can be set in two ways. The first is in $HOME/ghorg/conf.yaml. This file will be created from the .sample-conf.yaml and copied into $HOME/ghorg/conf.yaml. The second is setting flags via the cli, run $ ghorg clone --help for a list of flags

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/conf.yaml, or see Troubleshooting section below.

To view all other default environment variables see .sample-conf.yaml

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
  • If cloning via HTTPS make sure the osxkeychain has your github access token. This can be determined by running the security command above.
    • If this command does not return anything either switch to cloning via ssh (update your $HOME/ghorg/conf.yaml) or set it up by following this GitHub Documentation
    • If your GitHub account is behind 2fa follow this StackOverflow Post or this Github Documentation as noted in comments be sure to use your token as your username and give a blank password.

Updating brew tap

Description
No description provided
Readme Apache-2.0 12 MiB
Languages
Go 71.1%
Shell 27.2%
Dockerfile 0.7%
Ruby 0.5%
Makefile 0.2%
Other 0.3%