【发布时间】:2012-11-18 02:18:16
【问题描述】:
使用 GitHub Windows 客户端,我进行了 同步 以将远程更改拉到本地计算机,但在完成同步之前,我的磁盘空间不足并且同步失败。现在我似乎有一堆本地更改,这些更改实际上是从原点提取的更改。我尝试运行 git pull 但得到:
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
所以现在我正在尝试放弃本地更改,但我得到了:
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
我怎样才能清理这个? (在开始同步之前我没有任何本地更改。)
更新
似乎无法重置头部..
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'.
【问题讨论】:
-
您是否在此期间释放了一些空间?这将是重命名失败的原因之一。如果这不是重命名失败的原因,您可以尝试删除
.git/index(或将其移至其他位置,以防万一),然后再次尝试git reset --hard HEAD -
是的,我清理了一些演出空间。尝试移动索引文件并发现一个进程已锁定它..
-
delete .git/index 为我工作。谢谢。它只是重新创建它。
-
一旦 GitHub for Windows 将使用 git 2.8.4(2016 年 6 月),您应该不会再看到该错误。 See my report here)
标签: windows git windows-7 github