Quickly clone or backup massive amounts of org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more
Quickly clone or backup massive amounts of org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more
Pronounced [gore-guh]; similar to gorge. You can use ghorg to gorge on orgs.
Use ghorg to quickly clone all of an orgs, or users repos into a single directory. This can be useful in many situations including
With default configuration ghorg performs two actions.
- Will clone a repo if its not inside the clone directory.
- If repo does exists locally in the clone directory it will perform a git pull and git clean on the repo.
So when running ghorg a second time on the same org/user, all local changes in the cloned directory by default will be overwritten by what's on GitHub. If you want to work out of this directory, make sure you either rename the directory or set the
--no-cleanflag on all future clones to prevent losing your changes locally.
The terminology used in ghorg is that of GitHub, mainly orgs/repos. GitLab and BitBucket use different terminology. There is a handy chart thanks to GitLab that translates terminology here. Note, some features may be different for certain providers.
There are a installation methods available, please choose the one that suits your fancy:
For each installation method, optionally create a ghorg configuration file. See the configuration section for more details.
mkdir -p $HOME/.config/ghorg
curl https://raw.githubusercontent.com/gabrie30/ghorg/master/sample-conf.yaml > $HOME/.config/ghorg/conf.yaml
vi $HOME/.config/ghorg/conf.yaml # To update your configurationSee latest release to download directly for
If you don't know which to choose its likely going to be the x86_64 version for your operating system.
brew install ghorgIf you use Mise, you can install the latest version of ghorg on Linux/MacOS/Windows:
mise use -g ghorg@latestEnsure $HOME/go/bin is in your path
go install github.com/gabrie30/ghorg@latestWindows users can also install ghorg using scoop
scoop bucket add main
scoop install ghorgPrecedence for configuration is first given to the flags set on the command-line, then to what's set in your $HOME/.config/ghorg/conf.yaml. This file comes from the sample-conf.yaml and can be installed by performing the following.
mkdir -p $HOME/.config/ghorg
curl https://raw.githubusercontent.com/gabrie30/ghorg/master/sample-conf.yaml > $HOME/.config/ghorg/conf.yaml
vi $HOME/.config/ghorg/conf.yaml # To update your configurationIf no configuration file is found ghorg will use its defaults and try to clone a GitHub Org, however an api token is always required.
You can have multiple configuration files which is useful if you clone from multiple SCM providers with different tokens and settings. Alternative configuration files can only be referenced as a command-line flag --config.
If you have multiple different orgs/users/configurations to clone see the ghorg reclone command as a way to manage them.
Note: ghorg will respect the XDG_CONFIG_HOME environment variable if set.
Note: if you are running into issues, read the troubleshooting and known issues section below
repo scopes. Update GHORG_GITHUB_TOKEN in your ghorg/conf.yaml or as a cli flag or place it in a file and add the path to GHORG_GITHUB_TOKEN. If your org has Saml SSO in front you will need to give your token those permissions as well, see this doc.--base-url e.g. ghorg clone <github_org> --base-url=https://internal.github.comGHORG_GITHUB_APP_PEM_PATHGHORG_GITHUB_APP_IDGHORG_GITHUB_APP_INSTALLATION_ID. NOTE: you will need to use the actual GitHub url to get this ID, go to your GitHub Organization Settings Page -> Third Party Access -> GitHub Apps -> Configure -> Get ID from URLread_api scope (or api for self-managed GitLab older than 12.10). This token can be added to your ghorg/conf.yaml or as a cli flag.GitLab Specific config in your ghorg/conf.yaml or via cli flags or place it in a file and add the path to GHORG_GITLAB_TOKENGHORG_SCM_TYPE to gitlab in your ghorg/conf.yaml or via cli flagsGHORG_GITEA_TOKEN in your ghorg/conf.yaml or use the (--token, -t) flag or place it in a file and add the path to GHORG_GITEA_TOKEN.GHORG_SCM_TYPE to gitea in your ghorg/conf.yaml or via cli flagsCodeberg runs Forgejo, which is API-compatible with Gitea, so ghorg reuses its Gitea backend and defaults the base URL to https://codeberg.org (no --base-url required). Self-hosted Forgejo instances are also supported by setting --base-url; instances served over http additionally require --insecure-codeberg-client.
read:organization and read:repository scopesGHORG_CODEBERG_TOKEN in your ghorg/conf.yaml or use the (--token, -t) flag or place it in a file and add the path to GHORG_CODEBERG_TOKEN.GHORG_SCM_TYPE to codeberg in your ghorg/conf.yaml or via cli flagsGHORG_SOURCEHUT_TOKEN in your ghorg/conf.yaml or use the (--token, -t) flag or place it in a file and add the path to GHORG_SOURCEHUT_TOKEN.GHORG_SCM_TYPE to sourcehut in your ghorg/conf.yaml or via cli flagsNote on usernames: You can specify sourcehut usernames with or without the
~prefix (e.g., bothghorg clone usernameandghorg clone ~usernamework). Local folder paths will never include the~prefix to avoid shell expansion issues.
For detailed examples, API limitations, and sourcehut-specific features, see examples/sourcehut.md
Note: ghorg supports both Bitbucket Cloud and Bitbucket Server (self-hosted instances)
Bitbucket has deprecated App Passwords in favor of API Tokens. This is the recommended authentication method for Bitbucket Cloud.
GHORG_BITBUCKET_API_TOKEN in your $HOME/.config/ghorg/conf.yaml or use the --token flagGHORG_BITBUCKET_API_EMAIL to your Atlassian account email (or use --bitbucket-api-email)bitbucket in your ghorg/conf.yaml or via cli flagsNote: When using API tokens, ghorg automatically uses `x-bitbucket-api-to
No open issues yet, or sync has not completed.