Can I create remote github repo without local one with gh cli?

461 Views Asked by At

I know gh cli creates a local and remote repo with gh repo create. But I created and worked on my local repo with git init and so on. Then I want to create a remote repo and add that remote repo to my local one just to push it.

So if I use gh repo create, it tries to create a local <> repo inside the one im working on. If I say dont do that, it discard all the process, so no remote repo created.

I just want to create a remote named repo and then add that to my local one whitout complicated scripts or without leaving cli.

I feel gh repo create miss a step when you don't want to create a local repo but a remote one, so discard is the last extra step. Is all of this right?

I read the gh cli docs but didn't find answers to my needs.

1

There are 1 best solutions below

0
On

I missunderstood the docs as the CLI promts with this line: This will create '<remote-name>' in your current directory. Continue?

So I thought this creates an new local repo inside your repo with the name of the remote one.

This is wrong as the docs says this:

Inside a git repository, and with no arguments, gh will automatically create a repository on GitHub on your account for your current directory, using the directory name.

Solved.