首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从index.lock重命名到索引失败

从index.lock重命名到索引失败
EN

Stack Overflow用户
提问于 2012-11-29 21:53:07
回答 25查看 80.5K关注 0票数 66

使用GitHub Windows客户端,我执行了同步操作,以将远程更改拉到本地计算机上,但在完成同步之前,磁盘空间用完了,同步失败。现在我似乎有一些本地的变化,实际上是从原点上提取出来的变化。我试着拉着它跑,但得到了:

代码语言:javascript
复制
C:\Users\Tom\SourceLog [master +4 ~26 -0 !]> git pull
Updating b3a86e1..5afd74f
error: Your local changes to the following files would be overwritten by merge:
        SourceLog.Interface/IChangedFile.cs
        SourceLog.Interface/ILogEntry.cs
        ...
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
        Lib/MSBuildExtensionPack/4.0.6.0/Ionic.Zip.dll
        Lib/MSBuildExtensionPack/4.0.6.0/MSBuild.ExtensionPack.dll
        ...
Aborting

因此,现在我试图放弃本地更改,但我得到了:

代码语言:javascript
复制
C:\Users\Tom\SourceLog [master +4 ~26 -0 !]> git checkout -- .
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) y
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) n
fatal: unable to write new index file

我怎么才能把这个清理干净?(在启动同步之前,我没有进行任何本地更改。)

更新

似乎不能重置头部..。

代码语言:javascript
复制
C:\Users\Tom\SourceLog [master +4 ~0 -0 !]> git reset head
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) y
Rename from '.git/index.lock' to '.git/index' failed. Should I try again? (y/n) n
error: Could not write new index file.
fatal: Could not reset index file to revision 'head'.
EN

回答 25

Stack Overflow用户

回答已采纳

发布于 2012-11-29 22:41:37

下面的进程对.git\index文件进行了锁定:

代码语言:javascript
复制
ssh-agent.exe
C:\Users\Tom\AppData\Local\GitHub\PortableGit_8810fd5c2c79c73adcc73fd0825f3b32fdb816e7\bin\ssh-agent.exe

我杀死了这个过程,运行了git reset HEAD,看起来我现在恢复正常了。

票数 37
EN

Stack Overflow用户

发布于 2017-03-30 02:25:15

在我的例子中,这是由使用来自admin和non命令提示的相同的Git造成的。当最后一次git pull来自管理cmd时,由它创建index,然后非管理cmd没有足够的权限来修改它。

我的解决方案是重新创建index (同时保持工作树完整):

代码语言:javascript
复制
del .git\index
del .git\index.lock
git reset --mixed head
票数 36
EN

Stack Overflow用户

发布于 2020-04-25 23:32:59

在我的例子中,我不得不关闭VS代码,这是我从WSL Ubuntu终端用code .打开的。

票数 33
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13635429

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档