Git 从 index.lock 重命名为 index 失败 [英] Git rename from index.lock to index failed

查看:127
本文介绍了Git 从 index.lock 重命名为 index 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 GitHub Windows 客户端我做了一个 sync 将远程更改拉到我的本地机器上,但在完成同步之前,我用完了磁盘空间并且同步失败.现在我似乎有一堆本地更改,这些更改实际上是从源中提取的更改.我试图运行 git pull 但得到了:

Using the GitHub Windows client I did a sync to pull remote changes to my local machine, but before finishing the sync, I ran out of disk space and the sync failed. Now I seem to have a bunch of local changes that are actually changes that were being pulled from origin. I tried to run git pull but got:

C:UsersTomSourceLog [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

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

So now I'm trying to discard the local changes but I'm getting:

C:UsersTomSourceLog [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

我该如何清理它?(在开始同步之前,我没有进行任何本地更改.)

How can I clean this up? (I didn't have any local changes before starting the sync.)

似乎无法重置头..

C:UsersTomSourceLog [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'.

推荐答案

看起来下面的进程锁定了 .gitindex 文件:

Looks like the following process had a lock on the .gitindex file:

ssh-agent.exe
C:UsersTomAppDataLocalGitHubPortableGit_8810fd5c2c79c73adcc73fd0825f3b32fdb816e7inssh-agent.exe

我终止了进程并运行了 git reset HEAD 并且看起来我现在恢复正常了.

I killed the process and ran git reset HEAD and looks like I'm back to normal now.

这篇关于Git 从 index.lock 重命名为 index 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆