idea中新建git项目push rejected失败master -> master (fetch first) error: failed to push some refs to异常
发布日期:2021-06-30 21:31:30 浏览次数:2 分类:技术文章

本文共 1518 字,大约阅读时间需要 5 分钟。

场景

新建项目关联gitlab后进行push提交出错

Updates were rejected because the remote contains work that you doerror: failed to push some refs to 'git@xxxxxx'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.

原因分析

  • 拒绝原因是在gitlab或github上创建项目时创建README.md,此时远程版本与本地不一只,无法直接提交。
  • 需要对远程版本和本地版本进行合并,保证本地为最新版本即可。

解决方案

本地拉取远程版本进行合并即可

git pull --rebase origin master
lizzdeMacBook-Pro:lizz-boot-parent lizz$ git pull --rebase origin masterwarning: no common commitsremote: Enumerating objects: 3, done.remote: Counting objects: 100% (3/3), done.remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0Unpacking objects: 100% (3/3), done.From https://github.com/lizz365/lizz-boot-parent.git * branch            master     -> FETCH_HEAD * [new branch]      master     -> origin/masterFirst, rewinding head to replay your work on top of it...Applying: xxxxxxx

效果

提交成功

lizzdeMacBook-Pro:lizz-boot-parent lizz$ git push origin masterEnumerating objects: 4, done.Counting objects: 100% (4/4), done.Delta compression using up to 4 threadsCompressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 1.26 KiB | 1.26 MiB/s, done.Total 3 (delta 0), reused 0 (delta 0)To https://github.com/lizz365/lizz-boot-parent.git   240367d..9adbf75  master -> master

 

转载地址:https://lizz6.blog.csdn.net/article/details/109550237 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Spring-boot-start-web工程空包大小
下一篇:Dubbo源码解析之加权轮询策略RoundRobinLoadBalance

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年04月06日 11时44分25秒