git push --set-upstream

我在本地建了一個分支wangxiao,開發完以後,提交代碼git

git add .
git commit -m '註釋'
git push

出現下面的問題,這個意思是:當前分支沒有與遠程分支關聯。
所以致使了提交代碼失敗。web

MacBook-Pro-5:web-crm wangxiao$ git push
fatal: The current branch wangxiao has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin wangxiao

解決方案:
(1)直接 git push origin wangxiao 推向制定的分支,最強暴的方法。
(2)正如上面所說關聯遠程分支。spa

git push --set-upstream origin wangxiao
origin 是默認的遠程版本庫名稱
這樣關聯有一個好處,之後就不用每次git push都用第(1)種方法。
--------------------- .net

 

https://blog.csdn.net/boysky0015/article/details/81007897blog

相關文章
相關標籤/搜索