git push错误(fatal: The upstream branch of your current branch does not match)解决方案

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hl_java/article/details/80751286

有时候通过git push命令时会提示不成功,错误提示如下:

localhost:lean-server alioo$ git push
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:develop

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

    git push origin feature/20180620issuearchive

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

根本原因在于本地分支feature/20180620issuearchive是从远程分支develop拉取的,在执行git push命令时,不知道应该与远程哪个分支进行同步,就会出现上面那个错误

解决办法有2个:
1. 要不采取上面给出的建议,执行 git push origin feature/20180620issuearchive即可
2. 也可以重新指定与远程同名的分支(推荐这种方式,执行之后以后就可以git push了)
git push -u origin feature/20180620issuearchive

猜你喜欢

转载自blog.csdn.net/hl_java/article/details/80751286