Cross-posting from my Medium entry.
Medium: Arisa F
Hi, it’s Arisa, a freelance Full Stack Developer living in Germany.
I’m sure you’re looking at this entry because you got an error in your terminal or PowerShell from Git.
I also got the error says,
error: src refspec master does not match any. error: failed to push some refs to '<REPO_URL>'
The situation here is very basic.
Thought about to create a new repository in my Github.
I already had my project ready in my local and simply only needed to create a new repo, then push my project.
You should see in your Github repo page you just created like this.
It’s easy, just follow as it’s written in “…or create a new repository on the command line.”
Normally, it works and you’ll see README.md is added.
But if you’re unlucky, you’ll see an error like in above.
What to do?
It’s not a big deal.
Just add and commit something change to your repo, like adding .gitignore or any changes.
Then re-run push command.
Why does it work?
A trick behind here is starting to know this.
Git creates a master branch only after commit to your local repo.
If you just initialize repo then there is no master.
That’s why Git returns you an error says,
src refspec master does not match any.
No more getting a heart attack from command errors.
Hope this entry helped you to work on your project.