:point_right: secret scanning problem - git pre-c...
# infisical-help
g
👉 secret scanning problem - git pre-commit hook. 👈 When installing the pre-commit hook with
infisical scan install --pre-commit-hook
it doesn’t work right away. The problem is because the hook script has a check of:
Copy code
git config --bool hooks.infisical-scan
to determine if scanning is active or not, but that config flag is not switched on, or even exists. Indeed, the docs give instructions for how to switch the hook off, using that boolean config. I had to manually run this:
Copy code
git config --bool hooks.infisical-scan true
to get the flag activated so that the scan pre-commit works. I’m not sure if this is a doc problem, or a problem with the CLI? Anyway - just letting you know.
p
Hi @Gabriel Fortuna! Thanks for flagging this and for digging into the hook script! One thing I'd love to understand: on our end the hook is meant to run by default, since the check is != "false" (an unset flag should already count as enabled). So I'm curious what was actually getting in the way before you set it. Would you mind sharing what git config core.hooksPath prints, and which CLI version you're on? Sometimes another tool like Husky repoints that away from .git/hooks, which would quietly stop the hook from running.
g
Hi @Pylon @Jake Hulberg - see below. My problem was that the hook was not set at all. That causes the
if
check to fail. Error message is in the screenshot’s first example. An unset flag throws the
sh: [: !=: unary operator expected
error. Note: I tried with both
bash
and
sh
. Same results. I am not using Husky or any other git hook mgmt tooling. So it definitely was not that. Just a simple garden-variety shell condition check bug.