Clone all repositories from a GitHub organisation with a single command.
./github-org-clone openshift | shThis fetches the repo list from GitHub, then outputs git commands to stdout. Pipe to sh to run them.
By default:
- Clones to
~/src/github.com/<org>/<repo> - Only clones public repositories
- Only clones source repositories (repos the org owns, not forks)
- Skips empty repositories
The default path follows the convention ~/src/<forge>/<org>/<repo>, so you can organise clones from different forges (github.com, gitlab.com, etc.) in one place.
To test without writing to ~/src, use a temporary directory:
./github-org-clone --basedir /tmp/test --shallow frobware | shThis clones to /tmp/test/github.com/frobware/... instead. The --shallow flag makes it faster.
Run the same command again:
./github-org-clone openshift | shIf a repo already exists locally, it outputs a git fetch instead of git clone. Running periodically keeps everything in sync.
For large organisations, clone in parallel:
./github-org-clone openshift | parallel --bar --eta -j 8The --bar flag shows a progress bar, --eta shows estimated time remaining.
The included dop wrapper provides --bar and --eta by default, plus per-job logging and error summaries:
./github-org-clone openshift | ./dop -j 8By default, only source repos are cloned. To clone forks instead:
./github-org-clone --forks openshift | shSee what's in an org without cloning:
./github-org-clone --list openshiftOutput shows repo name, parent (if it's a fork), and archived status:
release-tests - -
appliance - -
some-fork upstream/original -
old-project - archived
For scripting, get JSON:
./github-org-clone --list --json openshiftClone only certain repos from an org:
./github-org-clone openshift release api console | shFiltering:
-s, --source Only source repos, not forks (default)
-f, --forks Only forked repos
-a, --no-archived Skip archived repos
--private Also include private repos (default: public only)
Listing:
-l, --list List repos and exit
--json JSON output (with --list)
Cloning:
-b, --basedir DIR Base directory (default: ~/src, or CLONE_BASEDIR env var)
--shallow Shallow clones (--depth 1)
Other:
-h, --help Show help
-v, --version Show version
Clone to a different directory:
./github-org-clone --basedir /tmp/test openshift | shShallow clone for a quick local copy:
./github-org-clone --shallow openshift | shPreview what would happen:
./github-org-clone openshift | headSkip archived repos:
./github-org-clone --no-archived openshift | shgh(GitHub CLI) - authenticatedjqgitparallelordop(optional, for parallel execution)