git: error: src refspec master does not match any

This question already has an answer here:

  • src refspec master does not match any when pushing commits in git 54 answers

  • If git status does indicate that you do have an active master branch (since you did make a first commit after all), check if you made any typo when defining your remote: see "Push origin master error on new repository":

    git remote rm origin
    

    Then I recreated the origin, making sure the name of my origin was typed EXACTLY the same way my origin was spelled.

    git remote add origin git@....
    

    You can simplify with:

    git remote set-url origin git@....
    

    Then you can establish a tracking link between the local branch and the remote tracking branch:

    git push -u origin master
    

    You can also push it to a different branch on origin:

    git push -u origin master:anotherBranch
    

    使用git branch -m将本地存储库重命名为具有要推送到远程的相同名称


    You need to make sure that the branch name is the same locally and remotely. So it's not enough to have master branch on remote. You also need this branch locally.

    链接地址: http://www.djcxy.com/p/16030.html

    上一篇: 克隆只有一个分支

    下一篇: git:error:src refspec master不匹配任何