If it is not possible, is there any way to do it without entering the browser and manually creating one, which then has to be synced to the local one?
Asked
Active
Viewed 58 times
1 Answers
-1
It's possible if you use Github's CLI tool, gh, with gh repo create. You'll have to install the tool first. There's no need for curl
Running gh repo create
will create a new repository interactively. The command has flags that allow cloning the new repo (--clone
) or create the new repo from a local folder (--source
) and even push immediately (--push
).
For example:
gh repo create my-project --private --source=. --push
gh auth login will use the browser to login and store a token locally so you don't have to authenticate every time.

Panagiotis Kanavos
- 120,703
- 13
- 188
- 236
-
Simple and straight to the point - thanks! Can I fetch the URL from the newly created repo in the GitHub CLI in any way so I can paste it directly into Git Bash? – Aleksandar Mar 03 '23 at 13:33
-
`gh` is a command-line tool which means you're already inside your shell when you use it. Whether that's Git's bash, wsl, Powershell or zsh doesn't matter. The new remote repository will be your local repository's `remote`. You can use `gh repo view` to view the repository's information, including its URL – Panagiotis Kanavos Mar 03 '23 at 13:40