码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-10-28 20:43:50      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:问题   date   ant   oca   use   通过   out   round   nta   

当我们在利用git  push 文件到仓库时出现了一下问题:

! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘git@github.com: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

标签:问题   date   ant   oca   use   通过   out   round   nta   

原文地址:https://www.cnblogs.com/yaogengzhu/p/9866759.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!