5

I am running

git gc --prune=now

and getting the result

Counting objects: 100% (619263/619263), done.
Delta compression using up to 8 threads
Compressing objects: 100% (132698/132698), done.
Writing objects: 100% (619263/619263), done.
Total 619263 (delta 316177), reused 608671 (delta 305796)
Unlink of file '.git/objects/pack/pack-15e469b10c92d51ece59ad7c055fc1ac64ff3056.pack' failed. Should I try again? (y/n) y
Unlink of file '.git/objects/pack/pack-15e469b10c92d51ece59ad7c055fc1ac64ff3056.pack' failed. Should I try again? (y/n) n
Unlink of file '.git/objects/pack/pack-4b025e2c952e34cf7b721520909ab216f6223fb3.pack' failed. Should I try again? (y/n) 

why is this ? and

how do I avoid to interact with the command which is asking me to input y/n?

Leo
  • 1,829
  • 4
  • 27
  • 51
  • 2
    check if these files is opened by other process. For example ide, version manmger tools, close them and retry. – LF00 Mar 12 '21 at 07:22

1 Answers1

3

If this is on Windows, make sure to use the latest Git For Windows since git gc was recently optimize to avoid that error.

If not, double-check there is no current process which could keep a handle to those Git files (as I illustrated here). For instance, try the same command right after a reboot.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250