Git - Unlink of file .idx and .pack failed (The only process owned handle to this file is git.exe)

泪湿孤枕 提交于 2019-11-26 17:17:22

问题


Please, look at this picture!

could be git that stupid? Git couldn't unlink some file, but only git.exe is holding a handle to this file. (Permissions are ok - Full control) Please, is there a safe solution for this problem? My Git version is 1.9.5-preview20141217

回答1:


Git 2.19 (Q3 2018) improves the file descriptors management for the packfiles, and avoid the "Unlink of file... failed. Should I try again?" error message.

See commit 12e73a3 (09 Jul 2018) by Kim Gybels (dscho).
(Merged by Junio C Hamano -- gitster -- in commit 562413e, 02 Aug 2018)

gc --auto: release pack files before auto packing

"git gc --auto" opens file descriptors for the packfiles before spawning "git repack/prune", which would upset Windows that does not want a process to work on a file that is open by another process.

Teach gc --auto to release pack files before auto packing the repository to prevent failures when removing them.

Also teach the test 'fetching with auto-gc does not lock up' to complain when it is no longer triggering an auto packing of the repository.

This solves the Git for Windows issue "Unlink of file XXX failed. Should I try again?", with PR 1769.




回答2:


I had this issue and solved it by the command : git gc The above command remove temp and unnecessary files (Garbage Collector): https://stackoverflow.com/a/26229658/532575



来源:https://stackoverflow.com/questions/29393415/git-unlink-of-file-idx-and-pack-failed-the-only-process-owned-handle-to-thi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!