search

Home  >  Q&A  >  body text

github - error occurs when using git push: src refspec master does not match any. What is the reason?

To use git push, take the following steps:

git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/focusor/focusor.github.io.git
git push -u origin master

The following error occurs:

error: src refspec master does not match any. 
error: failed to push some refs to "xxxxxxx"

Then the solution is as follows:

git add .
git commit -m "write your meaaage"

The push was successful after that. What is the specific reason?

PHP中文网PHP中文网2796 days ago1014

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-05-02 09:32:04

    This kind of error is usually caused by the fact that there is no file in the temporary storage area when pushing. Check whether the README.md of add exists

    reply
    0
  • PHPz

    PHPz2017-05-02 09:32:04

    The above is correct, your temporary storage area has no content

    reply
    0
  • Cancelreply