A GitHub CLI extension to clone all repositories in an organization or user account as quickly as possible.
v2.0.0 — Complete rewrite in Go with Cobra!
gh extension install svg153/gh-clone-orgOr build from source:
git clone https://github.com/svg153/gh-clone-org.git
cd gh-clone-org
go build -o gh-clone-org .
sudo cp gh-clone-org /usr/local/bin/# Clone all repos in an organization
gh clone-org github
# Clone to a specific directory
gh clone-org github -p ~/github
# Clone a user's personal repos
gh clone-org svg153 --user
# Preview what would be cloned (dry-run)
gh clone-org github --dry-rungh clone-org [org|user] [flags]
| Flag | Description |
|---|---|
-o, --org |
GitHub organization (positional arg alias) |
-p, --path |
Path to clone repositories (default: current directory) |
-s, --server-host-ssh |
SSH server host for multi-account setups (default: github.com) |
--update-org-folder |
Update existing repos and clone new ones |
--disable-clone-protection |
Disable GIT_CLONE_PROTECTION_ACTIVE |
--skip-archived |
Skip archived repositories |
--skip-forks |
Skip forked repositories |
--include-pattern |
Glob pattern to include repos (can be repeated) |
--exclude-pattern |
Glob pattern to exclude repos (can be repeated) |
--limit |
Maximum number of repositories to clone (0 = unlimited) |
--dry-run |
List repos that would be cloned without actually cloning |
-v, --verbose |
Increase verbosity: -v = clone status, -vv = git output, -vvv = debug info |
--user |
Clone user's personal repos instead of organization repos |
--profile |
Configuration profile (built-in: full, minimal, no-forks, or custom) |
--version |
Show version info |
-h, --help |
Help for this command |
# Clone all repos in an organization
gh clone-org kubernetes
# Clone to a specific directory
gh clone-org kubernetes -p ~/k8s
# Clone with verbose output
gh clone-org kubernetes -v# Skip archived and forked repos
gh clone-org github --skip-archived --skip-forks
# Clone only specific repos
gh clone-org github --include-pattern "cli-*"
# Exclude certain repos
gh clone-org github --exclude-pattern "test-*" --exclude-pattern "docs-*"
# Clone only first 10 repos
gh clone-org github --limit 10# Clone a user's personal repos
gh clone-org svg153 --user
# User mode with filters
gh clone-org svg153 --user --skip-forks --skip-archived# See what would be cloned without actually cloning
gh clone-org github --dry-run
gh clone-org github --dry-run --skip-forks --limit 5Built-in profiles:
- full: No filters, verbose mode
- minimal: Skip archived + forks, quiet mode
- no-forks: Skip forks only
# Use a built-in profile
gh clone-org github --profile minimal
# Use a custom profile from .gh-clone-org.yaml
gh clone-org github --profile productionCustom profiles in .gh-clone-org.yaml:
production:
skip_archived: true
skip_forks: true
verbose: 1
limit: 50
exclude_patterns:
- "test-*"
- "docs-*"# Clone from a GitHub Enterprise instance
gh clone-org mycompany -s github.mycompany.com
# Clone from a custom SSH host
gh clone-org mycompany -s github.company-ssh.com- Parallel cloning: Uses
runtime.NumCPU()workers with a semaphore channel - Rate limiting: Exponential backoff with jitter (1s base, 60s max, 25% jitter)
- Pagination: Handles orgs with 100+ repos via GitHub API pagination
- SSH URLs: Clones via SSH for authenticated access
- Error handling: Collects all errors and reports them at the end
- Fork the repository
- Create a feature branch (
feat/your-feature) - Make your changes
- Run tests:
bats test/ - Commit with Conventional Commits format
- Push and create a Pull Request
type(scope): description
- feat: add new feature
- fix: fix a bug
- docs: update documentation
- test: add or update tests
- refactor: code refactoring
- ci: CI/CD changes
- chore: maintenance tasks
This project is licensed under the MIT License - see the LICENSE file for details.