Search code examples
gitgarbage-collectionunlink

how to auto skip "Unlink of file Failed", when i run "git gc"


When i run "git gc", sometimes things go wrong.

Unlink of file '*******.pack' failed. Should I try again? (y/n)

I know I can skip it by typing "n". My question is: how to auto skip it, whitout any input.


Solution

  • You can set the GIT_ASK_YESNO environment variable to false. It doesn't seem to be documented anywhere, but it seems to not ask for input anymore (and thereby assuming you don't want it to try again).

    I got it from this answer and see it's being used in the git source here.