当前位置:   article > 正文

git本地与云端不一致时文件的提交_github仓库和本地文件的不一致怎么提交

github仓库和本地文件的不一致怎么提交

执行push出现问题:

git push origin master
  • 1

此时报错信息如下:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘https://github.com/xxxxxxx/xxxxxxx.git’
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull …’) before pushing again.
hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.

解决思路
① 同步云端到本地,取消两者差异
② 重新push到云端

解决方案

#方案1
git pull origin master --allow-unrelated-histories
git add xxx #添加差异文件
git push origin master

#方案2:强制上传
git push -f origin master
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/778629
推荐阅读
相关标签
  

闽ICP备14008679号