Git錯誤,fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream


問題:當我執行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可以根據你的需要自定義,就是當前分支在遠程分支對應的名稱)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM