一、現象:
(base) [root@DL xbiquge]# git push -u origin master
To https://github.com/sfccl/xbiquge.git
! [rejected] master -> master (fetch first)
error: 無法推送一些引用到 'https://sfccl:密碼@github.com/sfccl/xbiquge.git'
提示:更新被拒絕,因為遠程倉庫包含您本地尚不存在的提交。這通常是因為另外
提示:一個倉庫已向該引用進行了推送。再次推送前,您可能需要先整合遠程變更
提示:(如 'git pull ...')。
提示:詳見 'git push --help' 中的 'Note about fast-forwards' 小節。
二、原因及處理辦法
1、問題出現的原因是:在網頁進行了push提交動作。
2、處理辦法:強制push,方法如下:
(base) [root@DL xbiquge]# git push origin +master
枚舉對象: 149, 完成.
對象計數中: 100% (149/149), 完成.
Delta compression using up to 4 threads.
壓縮對象中: 100% (147/147), 完成.
寫入對象中: 100% (149/149), 86.90 MiB | 1.71 MiB/s, 完成.
Total 149 (delta 74), reused 0 (delta 0)
remote: Resolving deltas: 100% (74/74), done.
To https://github.com/sfccl/xbiquge.git
+ f7ac142...73353bd master -> master (forced update)
三、小結
避免這種情況的注意事項:不要通過網頁向倉庫提交文件。