Create, clone, and fork GitHub repositories with the gh CLI
domain: cli.github.com · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
Create a remote repo non-interactively: gh repo create my-repo --public (or --private / --internal); add -c/--clone to clone it locally
Publish an existing local repo: gh repo create my-repo --private --source . --push (with a bare repo, --push mirrors all refs)
Pick a license at creation with -l/--license <keyword>; list valid keywords with gh repo license list
Clone: gh repo clone owner/repo — when cloning a fork, the parent is automatically added as the 'upstream' remote (rename via -u/--upstream-remote-name, skip via --no-upstream)
Fork: gh repo fork owner/repo --clone — the fork becomes 'origin' and any existing origin is renamed 'upstream'; customize with --remote-name, --fork-name, --org, --default-branch-only
Docs: https://cli.github.com/manual/gh_repo_create , https://cli.github.com/manual/gh_repo_clone , https://cli.github.com/manual/gh_repo_fork (verified against gh 2.97.0, released 2026-07-31)
Known gotchas
gh repo create with no visibility flag prompts interactively — always pass --public/--private/--internal in scripts
After gh repo fork, the upstream remote is set as the default remote repository for other gh commands
gh repo fork without --clone prompts; pass --clone or --clone=false explicitly to skip the prompt in automation
Give your agent this knowledge — and 17,000+ more routes
One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?