nextjs - 💡(How to fix) Fix feat: Add block-no-verify to prevent Claude Code from bypassing git hooks [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#88369Fetched 2026-04-08 02:04:55
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1locked ×1

Add the block-no-verify package to prevent Claude Code from bypassing git hooks using the --no-verify flag.

Root Cause

Add the block-no-verify package to prevent Claude Code from bypassing git hooks using the --no-verify flag.

Code Example

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "npx block-no-verify"
          }
        ]
      }
    ]
  }
}
RAW_BUFFERClick to expand / collapse

Summary

Add the block-no-verify package to prevent Claude Code from bypassing git hooks using the --no-verify flag.

Problem

Claude Code can bypass pre-commit hooks by running git commit --no-verify, which defeats the purpose of code quality checks enforced by git hooks.

Proposed Solution

Integrate block-no-verify (v1.1.1) which:

  • Monitors git commands (commit, push, merge, cherry-pick, rebase, am)
  • Blocks execution when --no-verify or -n flag is detected
  • Integrates with Claude Code via PreToolUse hooks

Configuration Required

Create .claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "npx block-no-verify"
          }
        ]
      }
    ]
  }
}

Benefits

  • Enforces code quality checks even when using Claude Code
  • MIT licensed, lightweight dependency
  • No changes needed to existing git hooks setup

References

extent analysis

TL;DR

Integrate the block-no-verify package to prevent bypassing of git hooks when using Claude Code.

Guidance

  • To prevent Claude Code from bypassing git hooks, add the block-no-verify package to your project.
  • Configure Claude Code to use block-no-verify by creating a .claude/settings.json file with the specified settings.
  • Verify that block-no-verify is working correctly by attempting to run git commit --no-verify and checking that it is blocked.
  • Ensure that the block-no-verify package is installed and up-to-date, currently at version 1.1.1.

Example

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "npx block-no-verify"
          }
        ]
      }
    ]
  }
}

Notes

This solution assumes that the block-no-verify package is compatible with your project's existing git hooks setup.

Recommendation

Apply the workaround by integrating the block-no-verify package, as it effectively prevents bypassing of git hooks when using Claude Code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING