fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
用git init 初始化本地仓库后git remote add origin url添加远程仓库地址,add,commit文件至本地仓库后git push 出现这个问题。
问题原因:没有将远程分支设置为此分支上游。
解决办法:在初始化仓库后,将远程仓库主分支拉取下来并设置为本地仓库主分支。 ①git fetch (将远程仓库最新数据拉取至本地仓库) ② git checkout -b master origin/master
这时本地仓库数据已经和远程仓库数据一致,相当于git clone url,之后便可以add,commit,push数据。
The current branch master has no upstream branch.的解决
最新推荐文章于 2025-03-27 13:30:33 发布