I'm perplexed at how little I know about git, so I'm trying to create a project on GitHub to get some practice.
I've created an empty repository on the website, following this official guide
Then, as suggested:
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
I also configured a mail and name for this repository and continued the guide:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git remote add origin https://github.com/saatomic/test.git
git push -u origin master
It doesn't seem to matter what I try, I always get the following when I try to push the local data:
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/saatomic/test.git'
I'm quite lost - as I've strictly followed the propsed guide by GitHub.
What am I doing wrong and how do I correctly push my local data?
edit:
$ git remote -v
origin https://github.com/saatomic/test.git (fetch)
origin https://github.com/saatomic/test.git (push)
Update: I was able to do exactly the same on a different Linux VM, where everything succeeded as intended. This appears to be an issue of my local system. I can't grasp why (Updated Ubuntu 17.04), git version 2.11.0.
Update #2: I've retried the very same on an Ubuntu 16.04.3 LTS, git version 2.7.4, the same issue.
Update 3: Not a duplicate of this question. I've tried all the suggestions there, I should have mentioned that.
I've tried to add, commit and change branches, as suggested. The pushes still fail with the same error message.
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/saatomic/test.git'
Also suggested (both report nothing at all):
$ git show-ref
$
$ git branch
$
Force pushes don't work either and I do have a pending commit:
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: README.md
Solved: The issue was, that I had to configure the mail and username and then make a new commit.
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git commit -m "post-conf commit"