[BUG] 2.1.45: git commit silently fails (exit code 1, no output) when commit-msg hook rejects Co-Authored-By trailer

Resolved 💬 3 comments Opened Feb 18, 2026 by afrugalpenguin Closed Feb 22, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Git Commit Fails from Claude Code Bash Tool

Symptoms

  • git commit exits with code 1 and produces no visible output (no error, no success message)
  • The commit does not land (verified via git log)
  • Files remain staged after the failed commit
  • The same commit command succeeds immediately when run from terminal (cmd)
  • The commit-msg hook passes (✓ Commit message OK visible in user's terminal)

What still works from the Bash tool

git add, git status, git log, git diff, git reset — all work fine
git checkout works
Reading/writing files works
Only git commit is broken

echo "test" returned exit code 1 with no output
printf "test\n" returned exit code 1 with no output
file, xxd — exit code 1, no output
Some commands (like git log, git status, ls) work normally
GIT_TRACE=1 git commit ... also produced no output

Environment

Windows 11 Pro 10.0.26200
Bash shell (Git Bash / MSYS2)
Global core.hooksPath set to ~/.git-hooks/
The commit-msg hook uses grep, head, and echo with emoji (❌, ✓)
Claude Code model: claude-opus-4-6

What changed

Upgrading to 2.1.45 claude code.

Ruling things out

Not the Co-Authored-By rule — commits without it also fail from the Bash tool
Not the hook rejecting — the hook passes when run from the user's terminal with the same message
Not a staging issue — files are correctly staged (confirmed via git status)
Not repo-specific hooks — .git/hooks/ only contains .sample files; the active hook is global

What Should Happen?

The commit should proceed honouring any git hooks.

This worked without issue until upgrading to 2.1.45.

Error Messages/Logs

Steps to Reproduce

  1. Set up a global commit-msg hook (core.hooksPath = ~/.git-hooks/) that rejects commits containing a Co-Authored-By trailer
  2. Install Claude Code 2.1.45
  3. Stage a file change
  4. Ask Claude Code to commit the change
  5. Observe: git commit exits with code 1, no stdout/stderr output is shown, commit does not land, files remain staged
  6. Run the same commit command (without the trailer) from a regular terminal — succeeds
  7. Downgrade to 2.1.44: npm install -g @anthropic-ai/claude-code@2.1.44
  8. Repeat step 4 — commit succeeds

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.44

Claude Code Version

2.1.45

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗