gitgit-bashgit-push

Unable to create a new repository remotely


I am creating several new repositories and I want to automate it for a future product I am building. Got stuck on the first step. The following command works (at least there is no error message):

git remote add origin https://github.com/Account/image-re.git

However, when I try:

git push -u origin master

I get the follwing message:

remote: Repository not found. fatal: repository 'https://github.com/Account/image-re.git/' not found

If I do:

git remote -v

I get:

origin https://github.com/Account/image-re.git (fetch)

origin https://github.com/Account/image-re.git (push)

Which I think means everything is good at the other end? Now, I understand that I should use my username and password or username and token. But for various reasons I can't do that (including the fact that I don't want anyone to see my credentials, but other reasons too).

The key issue is this: I had the same problem earlier, but I was able to create a repositry on GitHub and then push to it. But I can't create a new repository on GitHub remotely. What is the solution?


Solution

  • git push does not create repositories. Consider using gh repo create:

    gh repo create image-re --public --push
    

    Of course, you should install GitHub CLI first.