[BUG] Claude repeatedly commits and pushes to git without explicit user request, despite clear instructions not to
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?
Claude Code consistently violates a fundamental user rule: never run git commit or git push without being explicitly asked to do so
What Should Happen?
Behavior:
After completing a set of file modifications, Claude systematically chains a git add, git commit, and git push without the user requesting it — often bundling them in a single &&
command. This happens even when:
- The rule is explicitly stated in a memory file (feedback_no_auto_commit.md)
- The rule has been repeated verbally many times during the session
- The user has corrected the behavior repeatedly in the same conversation
Why this is a serious problem:
- Git commits and pushes are irreversible actions that affect shared repositories
- The user loses control over what gets committed, when, and with what message
- The behavior erodes trust — the user cannot predict when Claude will take action on external systems
- Memory-based rules are insufficient because Claude does not reliably apply them across tool calls within the same session
What was tried:
- Explicit verbal instructions repeated 10+ times across multiple sessions
- A persistent memory entry flagging this as a hard rule
- A PreToolUse hook with permissionDecision: "ask" — partially effective but relies on auto-approval behavior
Expected behavior:
Claude should never call git commit or git push (or chain them) unless the user's message in that turn contains an explicit request to do so (e.g., "commit", "push", "commit and push").
Error Messages/Logs
Steps to Reproduce
- Tell Claude not to commit or push anything without expressly asked to do so
- Repeatdly make changes, then ask Claude to commit and push
After a few while, Claude automatically commit and push changes without being asked to
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.191 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
IntelliJ IDEA terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗