2

I am trying to push a new local "repo" into my GitHub account which doesn't exist with command:

git push https://github.com/username/gitinit

Getting error:

remote: Repository not found.
fatal: repository 'https://github.com/username/gitinit/' not found

My question is:

Can we create a repo (which doesn't exists in GitHub account) using command prompt Ubuntu?
And if we can then how?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
scadyy
  • 55
  • 7

1 Answers1

3

You would need to use the GitHub API for Repository in order to create a new repo from your Ubuntu shell session.

POST /user/repos

That is (from this tutorial):

curl -u 'YOUR-USER-NAME' https://api.github.com/user/repos -d '{"name": "PUT-YOUR-REPO-NAME-HERE"}'

You can add different options:

{
  "name": "Hello-World",
  "description": "This is your first repository",
  "homepage": "https://github.com",
  "private": false,
  "has_issues": true,
  "has_wiki": true,
  "has_downloads": true
}

Then:

git remote add origin https://github.com/username/gitinit.git
git push -u origin master

You can find more information/alternatives at "Is it possible to create a remote repo on GitHub from the CLI without opening browser?".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250