解决“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进行正常提交。

相关文章
|
1月前
|
开发工具 git 开发者
Git Pull vs. Git Fetch:深度解析
【2月更文挑战第29天】
728 0
Git Pull vs. Git Fetch:深度解析
|
1月前
|
开发工具 git 开发者
|
11月前
|
缓存 开发工具 git
【git】解决:remote: Permission to xxxx/xxxx.git denied to xxxx
【git】解决:remote: Permission to xxxx/xxxx.git denied to xxxx
414 0
|
20天前
|
缓存 开发工具 数据安全/隐私保护
mac git命令行操作 git push pull 逻辑
mac git命令行操作 git push pull 逻辑
13 1
|
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的解决
34 0
|
1月前
|
开发工具 git
git pull之后出现REBASE(1/1)
git pull之后出现REBASE(1/1)
33 3
|
1月前
|
网络安全 数据安全/隐私保护
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
|
7月前
|
网络安全 开发工具 git
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository
245 0
|
7月前
|
开发工具 git
解决Git push提交时Permission denied(publickey).Could not read from remote...的问题
解决Git push提交时Permission denied(publickey).Could not read from remote...的问题
69 0
|
1月前
|
开发工具 git
Git:error: remote origin already exists
Git:error: remote origin already exists
28 2