解决“hint: the same ref. If you want to integrate the remote changes, usehint: ‘git pull‘ before pus”

简介: 解决“hint: the same ref. If you want to integrate the remote changes, usehint: ‘git pull‘ before pus”

一、场景描述

具体场景描述:之前已经建好了仓库,提交过基础代码,时隔很久,继续推送新代码时,出现了问题,报错信息如下。

具体报错信息:


hint: the same ref. If you want to integrate the remote changes, use


hint: 'git pull' before pushing again.


hint: See the 'Note about fast-forwards' in 'git push --help' for details.


有道翻译结果:


提示:有本地。这通常是由于另一个存储库推送到完成


提示:相同的引用。如果要集成远程更改,请使用


提示:再推之前先拉一下。


提示:详见“git push—help”中的“关于快进的说明”。


原因总结:需要先pull 再push


二、解决策略

1.查看本地仓库和远程仓库是否建立联系   git remote -v


返回如下信息,本地和远程仓库联系正常


$ git remote -v origin


git@gitee.com:mobius8086/algorithm-learning.git (fetch) origin

git@gitee.com:mobius8086/algorithm-learning.git (push)


2.如上可以发现无法直接push,因此先进行 git pull,依次输入如下代码:

git pull

git pull origin master

git pull origin master --allow-unrelated-histories


3.此时会弹出一个gitee的验证框,进行验证即可


4.发生了如下错误:

详情操作:

错误:无法提取,因为您有未合并的文件。

提示:在工作树中修复它们,然后使用'git add/rm <file>'

提示:适当标记解决并提交。

致命的:因为未解决的冲突而退出。


5.先用“ git add . ”再使用“LL”观察输出信息。


6.正常commit 和push 即可提交成功


三、友情提示

1.再任何push操作之前,都请先pull操作。

2.出现错误后,先用指令行进行提交,执行成功后,即可用IDEA进行正常提交。

相关文章
|
开发工具 git 开发者
Git Pull vs. Git Fetch:深度解析
【2月更文挑战第29天】
2987 0
Git Pull vs. Git Fetch:深度解析
|
开发工具 git 开发者
深入解析:取消 Git Pull 操作的完整指南
【2月更文挑战第29天】
1795 0
|
10月前
|
开发工具 git
git fetch和 pull的区别
`git fetch`和 `git pull`在Git中扮演着不同的角色,了解它们的区别和使用场景对于高效管理代码库至关重要。通过合理使用这两个命令,可以更好地控制代码合并过程,减少冲突,提高团队协作效率。
821 97
|
开发工具 git Python
通过Python脚本git pull 自动重试拉取代码
通过Python脚本git pull 自动重试拉取代码
410 5
|
10月前
|
开发工具 git
git fetch和 pull的区别
通过这些内容和示例,您可以系统地理解 `git fetch`和 `git pull`的区别,并在实际工作中灵活应用这两个命令,提高版本控制的效率。希望这些内容对您的学习和工作有所帮助。
526 24
|
10月前
|
开发工具 git
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
787 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
10月前
|
安全 开发工具 git
git分布式版本控制系统及在码云上创建项目并pull和push
通过本文的介绍,我们详细讲解了Git的基本概念和工作流程,并展示了如何在码云上创建项目及进行pull和push操作。Git作为一种分布式版本控制系统,为开发者提供了强大的工具来管理代码变更和协作开发。希望本文能帮助您更好地理解和使用Git及码云,提高开发效率和代码质量。
428 18
|
10月前
|
安全 开发工具 git
git分布式版本控制系统及在码云上创建项目并pull和push
通过本文的介绍,我们详细讲解了Git的基本概念和工作流程,并展示了如何在码云上创建项目及进行pull和push操作。Git作为一种分布式版本控制系统,为开发者提供了强大的工具来管理代码变更和协作开发。希望本文能帮助您更好地理解和使用Git及码云,提高开发效率和代码质量。
301 16
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
599 1
|
网络安全 开发工具 git
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
650 0