error: src refspec master does not match any error: failed to push some refs to ‘github.com:Lydever/

本地关联github远程仓库,本地在 pull or push的时候报错:
error: src refspec master does not match any error: failed to push some refs to 'github.com:Lydever/typescript-projects.git'

原因

本地分支与远程分支不一致导致,2020年起,github上创建的仓库默认分支为main 而不再是master,而本地git 初始化后默认分支为master
error: src refspec master does not match any error: failed to push some refs to ‘github.com:Lydever/

解决

重命名分支,使分支名称一致:
master 重命名为main

git branch -m oldBranchName newBranchName

error: src refspec master does not match any error: failed to push some refs to ‘github.com:Lydever/
这个时候在pull或者push就不会报错了。
error: src refspec master does not match any error: failed to push some refs to ‘github.com:Lydever/

上一篇:iframe框架


下一篇:ubuntu20.04部署openresty