Skip to main content

Command referencegh repo create

gh repo create command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitbeginner

What it does

Create a new GitHub repository from the current directory or as an empty remote repo. When people search for gh repo create, they usually want practical GitHub CLI flags, safe examples, and how this subcommand fits everyday PR and repo workflows on Linux, Windows, and macOS. Syntax, options, and copyable examples are below.

Create a new GitHub repository from the current directory or as an empty remote repo.

Syntax

gh repo create [<name>] [flags]

Common options

Flag / optionMeaning
--publicMake the repository public.
--privateMake the repository private.
--sourceLocal path to use as the repository source.
--remoteLocal remote name to add (often origin).
--pushPush local commits after creating the remote.
--descriptionShort repository description.

Practical examples

Create from cwd

gh repo create my-app --private --source=. --remote=origin --push

Creates a private GitHub repo and pushes the current project.

Empty public repo

gh repo create demo --public

Creates an empty public repository under your account.

With description

gh repo create notes --public --description "Scratchpad"

Sets the GitHub description at creation time.

Common mistakes

  • Creating a public repo when the project still contains secrets.
  • Omitting `--source` when you meant to publish the current folder.

FAQ

What does gh repo create do in GitHub CLI?

Create a new GitHub repository from the current directory or as an empty remote repo.

Does gh repo create work on Windows and Linux?

Yes. The GitHub CLI (`gh`) runs on Linux, Windows, and macOS with the same subcommand syntax after you authenticate with `gh auth login`.

What is a practical gh repo create example?

Try `gh repo create my-app --private --source=. --remote=origin --push` — Creates a private GitHub repo and pushes the current project.

Do I need a token in the command line for gh repo create?

Prefer `gh auth login` so credentials stay in the system keyring or secure storage. Avoid pasting personal access tokens into shell history.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.