如何解决git====push 过程中出现的。error: failed to push some refs

Posted yaogengzhu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何解决git====push 过程中出现的。error: failed to push some refs相关的知识,希望对你有一定的参考价值。

当我们在利用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的主要内容,如果未能解决你的问题,请参考以下文章

GitIDEA+Git使用过程中git push rejected解决

git丨Push rejected: Push to origin/master was rejected

git冲突解决问题---多人修改同一文件

GIT用git push出现failed to push some refs to git...的解决方法

如何解决failed to push some refs to git

IDEA使用Git出现push to origin/master was rejected错误解决方案