上传至gitlab—— 本地git出现fatal: The current branch develop has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin develop 的问题

git 发生:

fatal: The current branch develop has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin develop

具体fatal错误如图:

这个错误就是 表示本地分支与远程分支之间没有连接起来。

解决方法:只需要在输入 git push -u origin develop(这个develop是远程分支名), 因为本身我就在本地的develop分支上面,所以可以直接 push,如下图,成功。如果本地不在develop分支上,可以先git checkout develop切换分支至本地develop分支再执行刚才那条推送命令推至远程develop分支。

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

原文地址:https://www.cnblogs.com/sirxy/p/12659041.html