How to Create a Git repository using github-cli?

14.4k views Asked by At

How do you create a GitHub repository using GitHub CLI (vs having to go to github.com and creating a github repo from their GUI)?

2

There are 2 answers

0
Zack Plauché On BEST ANSWER

GitHub just released their CLI (command line interface), so now you can create GitHub repos from command line / terminal.

Step 1:

Download the client for your system here

Step 2:

Once it's installed, run gh auth login in your command prompt and follow the instructions to log in.

Step 3:

After you're logged in, in your command prompt go to a directory where you want to create the repository, run git init in the project directory to initialize it.

Then run the command gh repo create and follow the instructions.

0
NearHuscarl On

To create a new repo in the current directory, run this command:

gh repo create myRepo

Here is an example of a more complex configuration:

gh repo create myAwesomeRepo --public -d 'my description' --enable-issues=false

To see more options when creating a repo, you can always ask for help:

gh repo create --help