新建本地倉庫,同步遠程倉場景,出現git branch --set-upstream-to=origin/master master 解決方法

https://www.cnblogs.com/kaibindirver/p/10617377.html

1.本地創建一個本地倉庫 
2.關聯遠程端:
git remote add origin [email protected]:用戶名/遠程庫名.git
3.同步遠程倉庫到本地
git pull

這個時候會報錯
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
再按提示執行
git branch --set-upstream-to=origin/master master
繼續報錯
fatal: branch 'master' does not exist
原因:
本地倉沒有在master上所以報錯了
解決:
4.在本地倉切換到master
git checkout master
那麼剛剛同步的文件就出來了

這裏實際遠程端的其他分支也同步了下來的了,但是git branch 不會展示出來
直接 git checkout 分支名 就可以直接切過去了

後記---dreamy說的
這裏如果 使用 15 .git clone [email protected]:用戶名/ --克隆遠程倉 那麼master 和分支 都會展示出來

實際: 試了也是一樣的 git branch 也是看不到 分支,但是實際也是下載下來了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章