Search code examples
gitgithubgithub-cli

How to Create a Git repository using github-cli?


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)?


Solution

  • 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.