git push到远程仓库时提示:fatal: The current branch master2 has no upstream branch. To push the current branch and set the remote as upstream,

use git push --set-upstream origin master2,如图:

大意是当前分支与远程分支没有建立关联,提示运行  git push --set-upstream origin master2 与远程仓库建立关联,运行后即可通过 git push 推送成功,如果已在远程github仓库中手动建过同名的本地分支也可通过另一种方法,即:

git push <远程主机名> <本地分支名>:<远程分支名>,两种方法如下:
一、 git push --set-upstream origin master2
二、 git push origin master2:master2

 

转载于:https://www.cnblogs.com/splendid/p/10008503.html

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐