Git - 解决 git push 出现 error: failed to push some refs to 错误

简介: Git - 解决 git push 出现 error: failed to push some refs to 错误

错误截图


image.png


背景


  1. 码云上创建了空项目
  2. 本地项目绑定了远程仓库,尝试git push,然后报了错

 

解决办法


使用强制命令git pull origin master --allow-unrelated-historie

后面加上  --allow-unrelated-histories , 把两段不相干的分支进行强行合;这里可能会进入一个编辑页面,只需要先ESC,然后敲 q! 即可, 或者根据它的页面提示如何操作可退出编辑页面即可

最后再push就可以了 git push -u origin master

相关文章
|
3天前
|
开发工具 git
在IDEA中配置Git的Push键
在IDEA中配置Git的Push键
10 0
|
22天前
|
开发工具 git
git push 提交后撤回--图文详解
git push 提交后撤回--图文详解
15 1
|
2月前
|
开发工具 git
记IDEA Git版本回退并push到远程操作
记IDEA Git版本回退并push到远程操作
30 1
记IDEA Git版本回退并push到远程操作
|
2月前
|
开发工具 git
|
2月前
|
开发工具 git
Git -- 代码上传错误 error: failed to push some refs to ‘git@gitee.com:JMFive/uni-shop2.git‘
Git -- 代码上传错误 error: failed to push some refs to ‘git@gitee.com:JMFive/uni-shop2.git‘
|
12天前
|
开发工具 git
完美解决git 执行git push origin master指令 报错command not found
完美解决git 执行git push origin master指令 报错command not found
21 0
|
19天前
|
缓存 数据可视化 网络安全
Git命令大全
Git命令大全
52 1
|
23天前
|
开发工具 git
Git教程:深入了解删除分支的命令
【4月更文挑战第3天】
43 0
Git教程:深入了解删除分支的命令
|
2月前
|
存储 Shell Linux
【Shell 命令集合 文件管理】Linux git命令使用教程
【Shell 命令集合 文件管理】Linux git命令使用教程
34 0
|
2月前
|
开发工具 git
git常用命令整理
git常用命令整理
13 0

相关实验场景

更多