A GitHub (gh) CLI extension to sync all repos from a GitHub organization.
Leverages Go concurrency to speed things up. The extension will get a list
of repos in the org and a list of the repos in the target local path and
create an action plan.
- Repos that do not exist locally will be cloned
- Repos that exist locally and in the org will be updated (
git fetch) - Repos that exist locally but not in the org will not be touched, but can be reported
-
Install the
ghCLI - see the installationInstallation requires a minimum version (2.0.0) of the GitHub CLI that supports extensions.
-
Install this extension:
gh extension install mantzas/gh-orgsync
The extension contains multiple required and optional flags.
- Org
--org {{orgname}}which is the org we want to sync. It is the only required flag - Path `--path {{path to local folder}} which defines the folder to sync to. When omitted local path is assumed.
- Degree Of Parallelism
--dop nwhich will define the number of workers which will be used. Default value is 50. - Sync only
--sync-onlywhich enables only syncing of existing local repos.") - Dry Run
--dry-runwhich will only report the action which would be taken - ReportFields
--report x,y,zwhich allows reporting options (error, cloned, synced and other). Default value is error. - Verbose
--verbosewhich enable verbose logging
Run:
gh orgsync --org {{add your GH org here}}