error: src refspec master does not match any

后端 未结 21 1190
别跟我提以往
别跟我提以往 2020-12-22 17:38

I have tried to follow the solutions suggested in this post but it didnt work and I am still getting: src refspec master does not match any.

Here is what I did: Fo

21条回答
  •  北海茫月
    2020-12-22 18:10

    FWIW, ran into same error, but believe it came about due to the following sequence of events:

    • Remote Git repo was created with master branch.
    • Local clone was then created.
    • Remote Git repo was then modified to include a dev branch, which was defined as the default branch, in conjunction with permissions added to the master branch preventing changes without a pull request.
    • Code updates occurred in the local clone, ready to be pushed to the remote repo.

    Then, when attempting to push changes from the local to the remote, received error "src refspec master does not match any", or when attempting to push to dev, "src refspec dev does not match any".

    Because changes were pending in the local clone, I did not want to blast it and refresh. So, fixed the issue by renaming the local branch to dev...

    $ git branch -m dev

    ...followed by the normal push of git push origin dev, which worked this time without throwing the aforementioned error.

提交回复
热议问题