Message 'src refspec master does not match any' when pushing commits in Git

前端 未结 30 2110
轮回少年
轮回少年 2020-11-22 02:49

I clone my repository with:

git clone ssh://xxxxx/xx.git 

But after I change some files and add and commit them,

30条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 03:14

    Short answer: This error means the branch you want to push in remote doesn't exist!

    In my case, starting from October-2020, the repos created since then had the main branch instead of the previous master branch. So all I had to do this:

    git push -u origin main 
    
    • you may skip -u flag if the upstream is set( Like in case you had cloned it already)

    Bingo! That worked for me! Hope that helps! Happy coding!

提交回复
热议问题