天天看點

git push錯誤(fatal: The upstream branch of your current branch does not match)解決方案

有時候通過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/issuearchive

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