DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to stop secrets before they are committed with Gitleaks

Add Gitleaks as a pre-commit hook so a commit containing a secret fails on the developer's machine.

Short answer: Install pre-commit from the pre-commit website; then create .pre-commit-config.yaml at the repo root with the Gitleaks repo, a rev and the Gitleaks hook id; Update to the latest version with pre-commit autoupdate. All steps.

Who it is forA small team that keeps finding API keys in pull requests after the fact.

The problemCatching secrets in review is too late: once pushed they are in history and must be rotated.

The outcomeCommits that contain hardcoded secrets fail locally with a Detect hardcoded secrets message.

What you need first

  • Homebrew, Docker, Go to build from source, or a release binary
  • pre-commit if you want the hook
  • Read access to the repos or folders you scan

Steps

  1. Install pre-commit from the pre-commit website
  2. Create .pre-commit-config.yaml at the repo root with the Gitleaks repo, a rev and the Gitleaks hook id
  3. Update to the latest version with pre-commit autoupdate
  4. Install the hook with pre-commit install
  5. Try a commit with a fake secret to confirm it fails; SKIP=Gitleaks bypasses the hook when you truly need to

Prompt for your agent

Set up gitleaks/gitleaks as a pre-commit hook in <repo>: write .pre-commit-config.yaml, run pre-commit autoupdate and pre-commit install, then prove it works by trying to commit a file with a fake API key. Do not commit the test file.

Caveat. Anyone can skip a local hook, so pair it with the GitHub Action or a CI scan for real enforcement.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for gitleaks/gitleaks and "Stop secrets before they are committed"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer