git 报错:error: failed to push some refs to 'https://gitee.com/xxx/******.git'

[git 报错:error: failed to push some refs to 'https://gitee.com/xxx/******.git'(已解决)]

提交push 报错:

$ git push origin master
To https://gitee.com/xxx/******.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/xxx/******.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.

这是因为远程库里面有个文件,但是本地没有这个文件,完全提交上去会覆盖之前的文件(通常是因为远程库自动生成了一个REMAND.MD的文件原因,但是本地没有add到这个文件)

我们直接强制push 下就可以了:

$ git push -u origin master -f

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容