git上傳本地工程到碼雲上,報錯:
fushaolei@DESKTOP-50PGGOT MINGW64 /f/teach/xcEdu/xcEduUI01/xc-ui-pc-static-portal (master)
$ git push origin master
To https://gitee.com/wise_happy/xc-ui-pc-static-portal.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/wise_happy/xc-ui-pc-static-portal.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
原因是:碼雲倉庫裏面的文件和本地倉庫裏面的文件並沒同步,如:README.en.md和README.md,所以才導致無法上傳的。
解決方案是:
① git pull origin master --allow-unrelated-histories //使用這個指令,來把遠程倉庫和本地同步,消除兩個文檔間的差異,其實也 就是把.md文件下載下來
2、git add . --再把本地文件添加至上傳出 git commit -m '提交' --上傳文件 (重新add和commit相應文件)
3、git push origin master --將文件push至碼雲
4、此時就能夠上傳成功了