What can/should I do about this git gc error? (rm: cannot unlink pack Permission denied)

"Permission denied" on Windows is often caused by a lock from a running process. It's probable that there is a stalled Git EXT thread opened the pack file.

Try to do the git gc in safe mode.

Another option is to clone the repository in a new place and delete the old one.


In my case it was TortoiseGit. To solve the problem I opened TortoiseGit Settings->Icon Overlays and set the Status cache to "None". Now the process TGitCache ended, so that all objects are "free" to be processed by git gc.

enter image description here