GitHub CLI Repos and Pull Requests/Create a public repo from current directory

Create a repository from the current directory and push initial contents.

Section: Repository Basics

Create a public repo from current directory

bash
bash
gh repo create my-new-repo --public --source=. --remote=origin --push
Explanation

Create a repository from the current directory and push initial contents.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Repository Basics
Create a repository interactively
Create a new repository with prompts.
OpenIn sheetbashsame section
Clone a repository
Clone a repository using OWNER/REPO syntax.
OpenIn sheetbashsame section
Clone into a specific directory
Clone a repository into a named local folder.
OpenIn sheetbashsame section
Fork current repository
Fork the current repository.
OpenIn sheetbashsame section
Fork and clone a repo
Fork a repo and clone your fork locally.
OpenIn sheetbashsame section
Set default repo context
Set the default repository for future gh commands in this directory.
OpenIn sheetbashsame section