git Updates were rejected because the remote contains work that you do 解決辦法
阿新 • • 發佈:2019-01-11
Username for 'https://github.com': dummymare Password for 'https://[email protected]': To https://github.com/dummymare/Hello-World.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/dummymare/Hello-World.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
進入專案目錄後,執行 git pull 命令,沒有將專案更新,並提示下圖:
2、If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
使用上面的命令就可以將本地的分支和遠端分支進行關聯了。
如下:
<a href="http://www.tbdazhe.com/wp-content/uploads/2013/12/QQ_20131210110802.jpg" class="cboxElement" rel="example4" 238"="" style="text-decoration: none; color: rgb(1, 150, 227);">
如圖:再執行git pull 就顯示已經ok了。