如何解決git====push 過程中出現的。error: failed to push some refs
阿新 • • 發佈:2018-10-28
round hang about -h font 通過 成功 oge mage
hint: (e.g., ‘git pull ...‘) before pushing again.
hint: See the ‘Note about fast-forwards‘ in ‘git push --help‘ for details. )
當我們在利用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