1

I have tried for the first time to upload files from my local computer to github.

On trying to upload them I get the error

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/name/file.git'

I have looked around stackoverflow for similar issues and found This question which I thought had answered my question. I added

git remote rm origin
git remote add origin https://github.com:name/file.git

and nothing happend, what else do I need to add?

===EDIT===

after further looking I found that

git commit -m 'my message' would do it

This returned the message

5 files changed, 162 insertions(+)

On going to my repository nothing has been added

Community
  • 1
  • 1
tony09uk
  • 2,841
  • 9
  • 45
  • 71

2 Answers2

0

You can not push unless you commit anything first.

You did commit. Nothing has changed - it was committed, but files stayed the same. You can push now.

aragaer
  • 17,238
  • 6
  • 47
  • 49
0

See "Why do I need to explicitly push a new branch?":

The first push to GitHub needs to be a:

git push -u origin master

Then, after making other commits, you will be able to simply "git push" those (no parameter required: the local master branch knows where to push)

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