1. 程式人生 > >如何解決git====push 過程中出現的。error: failed to push some refs

如何解決git====push 過程中出現的。error: failed to push some refs

round hang about -h font 通過 成功 oge mage

當我們在利用git push 文件到倉庫時出現了一下問題:

! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘[email protected]:yaogengzhu/ajax.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.

技術分享圖片

解決辦法:

1.強制上傳 git push -f //git倉庫地址 master (但是經過的測試 ,這個辦法好像會覆蓋掉倉庫的文件!謹慎使用!

2.方法二:a)可以通過如下命令進行代碼合並 git pull --rebase //倉庫地址 master

     b) 然後 通過 git push //倉庫地址 master (辦法可以成功的push 文件!且倉庫文件不受影響!建議使用

技術分享圖片

目前我掌握就這兩個方法~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

技術分享圖片

如何解決git====push 過程中出現的。error: failed to push some refs