使用GitHub Windows客户端,我执行了同步操作,以将远程更改拉到本地计算机上,但在完成同步之前,磁盘空间用完了,同步失败。现在我似乎有一些本地的变化,实际上是从原点上提取出来的变化。我试着拉着它跑,但得到了:
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'.发布于 2012-11-29 22:41:37
下面的进程对.git\index文件进行了锁定:
ssh-agent.exe
C:\Users\Tom\AppData\Local\GitHub\PortableGit_8810fd5c2c79c73adcc73fd0825f3b32fdb816e7\bin\ssh-agent.exe我杀死了这个过程,运行了git reset HEAD,看起来我现在恢复正常了。
发布于 2017-03-30 02:25:15
在我的例子中,这是由使用来自admin和non命令提示的相同的Git造成的。当最后一次git pull来自管理cmd时,由它创建index,然后非管理cmd没有足够的权限来修改它。
我的解决方案是重新创建index (同时保持工作树完整):
del .git\index
del .git\index.lock
git reset --mixed head发布于 2020-04-25 23:32:59
在我的例子中,我不得不关闭,VS代码,这是我从WSL Ubuntu终端用code .打开的。
https://stackoverflow.com/questions/13635429
复制相似问题