gh-repo-create
Create a new GitHub repository
TLDR
Create a new repository interactively
Create a private repository from the current directory
Create a public repository from the current directory
Create a public repository with a specified name and description
Clone the new repository locally after creation
SYNOPSIS
gh repo create [<name>] [--clone] [--description <text>] [--disable-wiki] [--disable-issues] [--enable-wiki] [--enable-issues] [--fill-pr] [--homepage <url>] [--name <name>] [--private | --public | --visibility <visibility>] [--push] [--push-only] [--remote <remote-name>] [--source <path>] [--template <owner/repo>]
PARAMETERS
--clone
Clone the newly created repository locally
--description <string>
Description of the repository
--disable-issues
Disable issues on the repository
--disable-wiki
Disable the repository wiki
--enable-issues
Enable issues (default: true)
--enable-wiki
Enable wiki (default: true)
--fill-pr
Create PR with changes from current branch
--homepage <string>
Repository homepage URL
--name <string>
Explicit repository name (defaults to directory basename)
--private
Make repository private (default: public)
--public
Explicitly make repository public
--push
Push current branch to new repository
--push-only
Push only, assume repo exists
--remote <string>
Name for new remote (default: origin)
--source <string>
Source directory or repo (default: current dir)
--template <string>
Template repository: <github.com/owner/repo>
--visibility <public|private|internal>
Set repository visibility
DESCRIPTION
The gh repo create command is part of the GitHub CLI toolset, enabling users to create new repositories directly from the terminal without visiting the GitHub website. It streamlines repository setup by allowing specification of name, description, visibility (public, private, or internal), and features like issues or wiki.
Run in a local directory, it infers the repo name from the basename unless overridden. It supports pushing existing code, cloning the new repo, or templating from existing repos. Ideal for automation in scripts or CI/CD pipelines.
Requires prior authentication via gh auth login. Integrates seamlessly with Git, adding remotes and pushing branches. Supports advanced options like filling pull requests from current branch changes.
Enhances productivity for developers by reducing context-switching, especially in monorepos or rapid prototyping workflows. Outputs repo URL upon success for immediate use.
CAVEATS
Requires gh auth login first; internet and GitHub account needed. Fails if name exists or lacks permissions. Not for GitHub Enterprise without config. Interactive prompts if flags omitted.
EXAMPLES
gh repo create --public --push
gh repo create myrepo --private --description 'My project'
gh repo create --template owner/template-repo --clone
AUTHENTICATION
Uses GitHub token via gh auth status. Supports GitHub.com, Enterprise. Refresh with gh auth refresh.
HISTORY
Introduced in GitHub CLI v0.5.0 (2020). Evolved with features like --template (v1.0+), --fill-pr (v2.0+). Actively maintained by GitHub for cross-platform use (Linux/macOS/Windows).


