git push之后报错 fatal: The current branch dev has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin dev

git push之后报错

fatal: The current branch dev_22_05-mcx has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin dev_22_05-mcx

原因:

新建的本地 dev 分支没有和远程的 dev 分支相关联。

解决办法一:

执行 git push -u origin dev(远程分支名),建立远程分支 dev 然后关联本地 dev 和远程 dev,若当前不在 dev 分支,则需先执行 git checkout dev 切换到 dev 分支,然后在执行 上述命令。

解决方法二:

按照提示执行 git push --set-upstream origin dev 将本地 dev 和远程 dev 分支相关联,然后再执行 git push 即可。

参考:https://blog.csdn.net/weixin_44514665/article/details/91956785

posted @ 2022-03-24 17:32  栖心  阅读(1113)  评论(0)    收藏  举报