git egit 锁失败日食
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49859734/
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
egit lock fail eclipse
提问by dabezt
So at work we all share the same stash were we push and pull our branches and all that good git stuff. So i usually do my pull and push from egit in eclipse (I am not the only one most people here do it this way). but some of my branches have started giving me the [lock fail] "couldn't lock local tracking ref for update". But the thing is there are 75+ people doing it the same way and no one has seen this error. I have done some research and most of it says it is based off name conflicts for example Foo and foo. Egit would get confused on which one to pull because the only difference is a capital letter, but other people are having no issues. I don't know what is going on. Any help would be greatly appreciated.
因此,在工作中,我们都共享相同的存储库,我们推拉我们的分支以及所有好的 git 东西。所以我通常在 eclipse 中从 egit 执行拉和推(我不是这里大多数人这样做的唯一一个)。但是我的一些分支机构开始给我 [锁定失败]“无法锁定本地跟踪引用以进行更新”。但问题是有 75+ 人以同样的方式做这件事,但没有人看到过这个错误。我做了一些研究,大部分研究表明它基于名称冲突,例如 Foo 和 foo。Egit 会混淆要拉哪个,因为唯一的区别是大写字母,但其他人没有问题。我不知道发生了什么。任何帮助将不胜感激。
回答by Arash Kamangir
git remote prune origin
solved it for me.
为我解决了。
回答by RotS
I could neither fetch nor push nor rebase, and got a "lock fail" error in eclipse too.
我既不能获取也不能推送也不能变基,并且在 Eclipse 中也出现了“锁定失败”错误。
The solution I found was to open git bash, go to git folder, then do a git fetch
. After this I was able to rebase and push with eclipse.
我找到的解决方案是打开 git bash,转到 git 文件夹,然后执行git fetch
. 在此之后,我能够使用 eclipse 进行变基和推送。
You can also check in your eclipse preferences/team/git/configuration that you have not set fetch.prune=true
because it may cause this problem.
你也可以在你的eclipse偏好/团队/git/配置中查看你没有设置的,fetch.prune=true
因为它可能会导致这个问题。
回答by Jeff Bennett
I've seen this a couple times in Eclipse 2019-06 now. Possibly related to tag-creation as it seems to have occurred recently after those events. In any event, I think if you close Eclipse, and delete eclipse-workspace/.metadata/.lock file (and possibly eclipse-workspace/.metadata/.log) it gets better on restart.
我现在已经在 Eclipse 2019-06 中看到了几次。可能与标签创建有关,因为它似乎是在这些事件之后最近发生的。无论如何,我认为如果您关闭 Eclipse,并删除 eclipse-workspace/.metadata/.lock 文件(可能还有 eclipse-workspace/.metadata/.log),它会在重新启动时变得更好。
回答by M Kaweepatt Churcharoen
For me, I encountered the lock fail problem in tags, so I do following steps:
对我来说,我遇到了标签中的锁定失败问题,因此我执行以下步骤:
- Reset current branch
- Delete all local tags.
- Fetch
- Pull. It solves the problem.
- 重置当前分支
- 删除所有本地标签。
- 拿来
- 拉。它解决了这个问题。
回答by David Wood
I used Arash's
我用了阿拉什的
git remote prune origin
But this left me with a situation in which an egit pull put me way ahead of the remote/origin. An egit or git push brought be back in sync, but then the next egit pull put me ahead again. To fix that, I tried various thing including Resetting the repo, but to no avail. This is probably similar to starting with a new workspace, but in my case that was not an option. The following seems to have worked:
但这给我留下了一种情况,在这种情况下,egit pull 使我领先于远程/起源。一个 egit 或 git push 恢复同步,但是下一个 egit pull 让我再次领先。为了解决这个问题,我尝试了各种方法,包括重置回购,但无济于事。这可能类似于从新工作区开始,但在我的情况下,这不是一个选项。以下似乎有效:
- Make sure you have pushed all changes to the remote repo.
- In the Project Explorer view, delete all projects that have been imported into eclipse from the repository in question. Don't delete files in the file system (check box in dialog box that pops).
- In the Repositories view, right click on repository and Remove Repository From View
- At the command line. move or delete the root of the git repo.
- Back to Eclipse and add the repository (in the Repository View, paste the URL/ssh link as copied from github).
- Re-import the desired projects into Eclipse by right-clicking on the repo and selecting Import Projects...
- 确保您已将所有更改推送到远程存储库。
- 在 Project Explorer 视图中,从相关存储库中删除所有已导入 eclipse 的项目。不要删除文件系统中的文件(弹出的对话框中的复选框)。
- 在存储库视图中,右键单击存储库并从视图中删除存储库
- 在命令行。移动或删除 git repo 的根目录。
- 返回 Eclipse 并添加存储库(在存储库视图中,粘贴从 github 复制的 URL/ssh 链接)。
- 通过右键单击 repo 并选择 Import Projects... 将所需的项目重新导入到 Eclipse 中。
Ugly but does the trick.
丑陋但有诀窍。
回答by Taha
The issue for me was that I had a bunch of branches that I had pulled as feature/somename
but when I pushed it to remote
, they appeared as Feature/somename
. Once I solved this f
to F
issue, things started working as expected.
对我来说的问题是我有一堆树枝,我已经拉过,feature/somename
但是当我把它推到时remote
,它们看起来像Feature/somename
. 有一次,我解决了这个f
到F
问题,事情开始按预期工作。
Prune using EGIT
使用 EGIT 修剪
Also, if you want to prune
the repository, you should use GIT GC in order to achieve this. EGIT has an option called Collect Garbage
to trigger this. Simply, right click on the repository in the EGIT perspective to see this option.
此外,如果您想要prune
存储库,您应该使用 GIT GC 来实现这一点。EGIT 有一个选项被调用Collect Garbage
来触发它。只需在 EGIT 透视图中右键单击存储库即可查看此选项。