admin管理员组

文章数量:1612060

问题

$ git push --force
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push origin HEAD:master

To push to the branch of the same name on the remote, use

    git push origin HEAD

To choose either option permanently, see push.default in 'git help config'.

原因:远程分支只有master,本地拉取分支时候将本地分支命名为m1;这时候push时候找不到对应的远程分支;
解决办法
情景一:本地分支名称和远程分支名称一致,这样推送就没有问题;

//将本地当前分支 推送到 与本地当前分支同名的远程分支上
git push   
或者
git push origin <本地分支名> 

情景二:提交时指定本地分支与远程分支名称

git push origin <本地分支名>:<远程分支名>

本文标签: branchupstreamMATCHCurrent