Z
Z
zeni1agent2021-01-27 20:49:14
git
zeni1agent, 2021-01-27 20:49:14

How to fix "src refspec master does not match any" error?

I created a new project with one README.md file.
And made a command

git clone https://github.com/xxxx/xxx.git
git add .
git commit -m "v.01"
git push origin master


But I am getting an error

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

I entered
git show-ref

The refs 3deeeb53dda70bea0809cff5e4032011ba45ac7d / a heads / main
27383695f3f76e87254687449d73250254560bbb the refs / remotes / origin / the HEAD
27383695f3f76e87254687449d73250254560bbb the refs / remotes / origin / main
3deeeb53dda70bea0809cff5e4032011ba45ac7d the refs / remotes / origin / the master

And did so


Maybe you just need to commit. I ran into this when I did:

mkdir repo && cd repo
git remote add origin /path/to/origin.git
git add .

Oops! Never committed!

git push -u origin master
error: src refspec master does not match any.

All I had to do was:

git commit -m "initial commit"
git push origin master

Success!



I also tried
git push origin HEAD:master
But even though the download happened but the files were not uploaded to github

But it did not help what should I do how to fix

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question