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

Locally associated with the github remote repository, and an error is reported locally when pulling or pushing:
error: src refspec master does not match any error: failed to push some refs to 'github.com:Lydever/typescript-projects.git'

reason

The inconsistency between the local branch and the remote branch is caused. Starting from 2020, the default branch of the warehouse created on github is mainno longer master, and the default branch after the local git is initialized ismaster
insert image description here

solve

Rename the branch to make the branch name consistent: rename
tomastermain

git branch -m oldBranchName newBranchName

insert image description here
At this time, pullor pushwill not report an error.
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43853746/article/details/122387056