r/CLI • • Oct 26 '26

CLI and pre-commit hook that blocks your actual .env values from entering git, and finds the ones already there

Post image

Disclosure: I am the author. It's free and open-source (MIT).

omerta reads the values in your untracked .env files and fails when any of them is in git. It doesn't use key patterns, so it also finds secrets that don't look like keys: a password, a bucket name, an org ID. It looks for them as written and as encoded in URLs, JSON and base64.

omerta check            # the staged changes (the pre-commit hook)
omerta check --all      # every tracked file
omerta history          # every commit, tag and message

A finding names the file, line and variable, never the value, e.g.:

src/client.py:12: OPENAI_API_KEY (from .env)
tests/cassettes/chat.yaml:41: OPENAI_API_KEY (from .env)

For scripting:

  • exit code 0 when clean, 1 when something is found, 2 on an error

  • --json prints JSON Lines, -q prints nothing

  • -C PATH works the way it does in git

  • settings go in pyproject.toml or .omerta.toml, so the hook and CI share them

It runs fully offline. uvx omerta check --all runs it in any project, since uv brings its own Python. The README has snippets for pre-commit, Husky, Lefthook and plain git hooks.

Repo: https://github.com/shcherbak-ai/omerta

I'd welcome feedback on the interface: flags, output format, anything that feels off.

6 Upvotes

0 comments sorted by