pre-commit: Stuck at "Locking pre-commit directory" after add a new hooks
Step to reproduce:
in earlier, my team using pre-commit for prettier
then we add a hooks for eslint
trying to commit a changes:
➜ web git:(xyzbranch) ✗ git commit -v -m "test"
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /Users/dwicao/.cache/pre-commit/patch1515120727.
[INFO] Locking pre-commit directory
just stuck at it
How to solve:
I deleted pre-commit
folder at ~/.cache/
try to commit again, and it just worked flawlessly 🎉
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 25
- Comments: 15 (8 by maintainers)
I know that this has been resolved and closed. The way to preproduce is killing the pre-commit process before finishing which doesn’t delete the lock file in ~/.cache/pre-commit/.lock .
was it maybe during
git commit
? there’s a known bug withgit
where it zombies git hook executables on interruption (and so it would have to complete naturally) – you should be able to find the process still holding the lock with a littleps
orlsof
I get this as well, on Linux. I can’t give steps to reproduce though.
that is a bad solution. you should find what process is holding the lock and then name a decision based on that. usually with
lsof
or some such