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
How to fix the pushing rejected and asked to pull when pulling results in "everything is up to date"?
提问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所示。
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所示。
How do I fix this problem?
我该如何解决这个问题?
采纳答案by VonC
Make sure that:
确保:
- you are using the latest version of EGit (2.3+)
- you have stashed/commit everything before pulling (as in this thread)
- you are not in a detached head mode (as in "can't push upstream using EGit")
- 您正在使用最新版本的 EGit (2.3+)
- 在拉取之前你已经隐藏/提交了所有内容(如在这个线程中)
- 您没有处于分离头模式(如“无法使用 EGit 向上游推送”)
in the end I noticed a class file was mentioned in the
DIRTY_WORKTREE
error 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,然后添加到索引。这将解决冲突(假设使用合并工具),然后您应该能够提交/推送您的更改,或者再次拉取。