問題:當我執行git push命令的時候,報錯如下:
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream
當前分支主服務器沒有上游分支,推送當前分支並將遠程服務器設置為上游
復現
首先創建遠程倉庫,然后在本地
git init
git remote add origin https://username@xxx.com/xxx.git
git add .
git remote add origin
git push
然后報錯
解決辦法
git pull
git push --set-upstream origin master(master可以根據你的需要自定義,就是當前分支在遠程分支對應的名稱)