git 如何解决在“一切都是最新的”中拉动结果时被拒绝并要求拉动的问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15475258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:46:46  来源:igfitidea点击:

How to fix the pushing rejected and asked to pull when pulling results in "everything is up to date"?

eclipsegitegit

提问by Marco Lackovic

Using EGit with Eclipse when I try to push my code into the remote repository I get an error message saying that I should pull first, as shown in Figure 1.

当我尝试将代码推送到远程存储库时,将 EGit 与 Eclipse 一起使用时,我收到一条错误消息,提示我应该先拉取,如图1所示。

Error dialog when trying to push

尝试推送时出现错误对话框

When I then try to pull from the remote repository I get a message saying that everything is up to date, as shown in Figure 2.

当我尝试从远程存储库中拉取数据时,我收到一条消息,指出一切都是最新的,如图2所示。

Message dialog after pulling

拉取后的消息对话框

How do I fix this problem?

我该如何解决这个问题?

采纳答案by VonC

Make sure that:

确保:



The OP Krigeadds:

OP克里格补充说

in the end I noticed a class file was mentioned in the DIRTY_WORKTREEerror message.
I deleted that file from the file system, did a pull, resolved the conflicts and pushed.
Everything seems to work fine now.

最后我注意到DIRTY_WORKTREE错误消息中提到了一个类文件。
我从文件系统中删除了该文件,进行了拉取,解决了冲突并进行了推送。
现在一切似乎都正常。

回答by paulscott56

If you have the DIRTY_WORKTREE issue and you are not able to delete the file (for whatever reasons), you should do a pull, or replace with HEAD and then add to Index. This will resolve the conflicts (assuming use of the merge tool) and you should then be able to commit/push your changes, or else pull again.

如果您有 DIRTY_WORKTREE 问题并且您无法删除文件(无论出于何种原因),您应该执行拉取,或替换为 HEAD,然后添加到索引。这将解决冲突(假设使用合并工具),然后您应该能够提交/推送您的更改,或者再次拉取。