3

When creating a local repo and trying to push it to github, ending up with an issue:

ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

My steps are standard - that what gitHub Help suggests to go with.

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:MyUser/my-samples.git
git push -u origin master

Then: git push -u origin master

Q: How can I push new repo/branch to the github?

Just clarifying: I wan to create New repository from command line remotely - it does not exist yet on my github.

Basically I'm trying to perform 11th step on http://try.github.io/

Btw. when I try to use https:// instead of just git@github.com:... (following that steps) I end up having 403 error.

If I use "ssh://", adding my keys on github, I end up having Repository not found error. But that test sh -T git@github.com passes successfully,

So UPDATE: yes I've checked my connection.

ses
  • 12,339
  • 25
  • 106
  • 203
  • 1
    The `fatal: The remote end hung up unexpectedly` error happens frequently when you can't connect to the remote host (in this case GitHub), so that may be your issue. What happens when you try to ping GitHub? –  Mar 13 '14 at 03:32

2 Answers2

3

So, I guess a simple answer is: it is impossible to create repo remotely by git remote add and push command.

Thus, when I do: git remote add origin git@github.com:MyUser/my-samples.git

It does NOT mean it is going to create NEW repo on the REMOTE host. It means it is going to link my origin master branch to remote one, which is supposed to be existing at that moment.

Then, probably there is an command that would create a repo/project remotely.

But it is different one - not git remote add .. and then push.

That being said, I consider +Akash Agrawal's corrent. Answering my question just to make it clear for myself.

--

That answers my question how to create it remotelly from command line: Is it possible to create a remote repo on GitHub from the CLI without opening browser?:

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

Or HUB: http://hub.github.com/

# create a repo for a new project
$ git init
$ git add . && git commit -m "It begins."
$ git create -d "My new thing"
→ (creates a new project on GitHub with the name of current directory)
$ git push origin master
Community
  • 1
  • 1
ses
  • 12,339
  • 25
  • 106
  • 203
1

You will need to create a repo on github to be able to push your changes to it. Bare repos are not initialized automatically. Otherwise spelling mistakes can lead to undesirable creation of new repos.

Akash
  • 4,615
  • 2
  • 26
  • 39
  • That's the thing - I'm expecting to create new repo on github without a need to go to it via browser. – ses Mar 13 '14 at 13:20