git pull导致“unlink of file failed”错误

我正在尝试做一个git pull并且遇到了可怕的“unlink of file xxx failed”错误.

我已经尝试过在this回答中定义的ProcessExplorer;使用find函数不会使用相关文件返回任何进程.

我也尝试过运行git gc,如this回答中提到的那样,它运行,但我仍然得到错误.

我对相关文件有写权限.

还有其他建议吗?这引起了一个重大问题.

最佳答案 这应该在Git 2.8(2016年3月)中修复

Johannes Schindelin (dscho),见commit d562102,commit dcacb1b,commit df617b5,commit 0898c96(2016年1月13日).
(于Junio C Hamano — gitstercommit 3c80940,2016年1月26日合并)

fetch: release pack files before garbage-collecting

Before auto-gc’ing, we need to make sure that the pack files are released in case they need to be repacked and garbage-collected.

Many codepaths that run “gc --auto” before exiting kept packfiles mapped and left the file descriptors to them open, which was not friendly to systems that cannot remove files that are open.
They now close the packs before doing so.

修复了git-for-widows issue 500.

看看test used to validate that new approach,也许你可以(因为Git 2.8尚未出局)人为地提高gc.autoPackLimit.

git config gc.autoPackLimit 10000
git fetch
git config gc.autoPackLimit 50 # default value
点赞