gh repo create
Create a repository on GitHub
What it does
With no arguments, gh repo create asks for everything step by step: the name, the visibility, whether to start empty or upload an existing folder. With flags it asks nothing, and then the visibility is required: --public or --private.
For a project you already have as a git repository, add --source=. and --push: gh creates the repository on GitHub, adds the remote origin and pushes the commits. For a new empty repository there is --clone instead: create it and clone it right away.
Syntax
gh repo create
gh repo create <name> --private --source=. --push
gh repo create <name> --public --cloneExamples
Create a private repository shop on GitHub from the current folder and push its commits
gh repo create shop --private --source=. --pushsame as:
gh repo create shop --private --source . --pushrepo create shop— create the repository shop--private— visible only to you and those you invite--source=.— use the local repository in the current folder--push— push the commits right away
Related commands
- git init — Create a new repository in the current folder
- git remote — List and add remote repositories
- git push — Send your commits to the server