问题
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 --autoto 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