AdministratorWIN-K3C9KG85CB8 MINGW64 wsllocalhostUbuntu-2204homeSmartHome master$ git pushfatal The current branch master has no upstream branchTo push the current branch and set the remote as upstrea
在Git中解决"fatal: The current branch master has no upstream branch"错误,可以按照以下步骤进行操作:
-
执行命令:
git push --set-upstream origin master。这将推送当前分支并设置远程分支为上游分支。 -
如果你希望自动设置远程分支为上游分支,请执行命令:
git config push.autoSetupRemote true。这样,在将来创建没有上游分支的分支时,Git将自动设置远程分支为上游分支。
执行以上两个步骤后,再次执行git push命令即可成功推送代码。
原文地址: https://www.cveoy.top/t/topic/iArb 著作权归作者所有。请勿转载和采集!