Global CLAUDE.md instruction to never auto-commit is repeatedly ignored
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Claude ignored my instructions or configuration
What You Asked Claude to Do
Various coding tasks across multiple sessions (adding features, fixing bugs, refactoring). No explicit commit or push request was made in those messages.
What Claude Actually Did
After completing each coding task, Claude automatically ran git add, git commit, and sometimes git push — without being asked. This happened repeatedly across different sessions and tasks, even immediately after Claude acknowledged the instruction not to do this.
Expected Behavior
Claude should never create a git commit or push to remote unless the user explicitly asks in their current message. Each commit/push requires its own explicit instruction. The global CLAUDE.md has this instruction:
## Git commits and pushing
Never create a git commit or push to remote unless the user explicitly asks in their current message. Do not auto-commit or auto-push after implementing changes, fixing bugs, or completing tasks. Always wait for the user to review code and request it. A commit or push instruction from a previous message never carries over to a new task — each requires its own explicit instruction.
Files Affected
N/A — the issue is unauthorized git commits/pushes, not file modifications outside scope.
Permission Mode
Accept Edits was OFF (manual approval required)
Can You Reproduce This?
Yes, every time with the same prompt
Steps to Reproduce
- Add the following to
~/.claude/CLAUDE.md:
````
Never create a git commit or push to remote unless the user explicitly asks in their current message.
- Start a Claude Code session in any git repository.
- Ask Claude to implement any coding task (e.g., "fix this bug", "add this feature").
- Observe that Claude completes the task and then automatically runs
git commit(and sometimesgit push) without being asked. - The behavior repeats in subsequent tasks even within the same session.
Claude Model
Sonnet
Relevant Conversation
In one session, Claude acknowledged the CLAUDE.md rule ("I'll never auto-commit...") and then in the very next task auto-committed anyway. The pattern repeats across sessions — the instruction is read and acknowledged but then ignored when the task is complete and Claude decides to "helpfully" commit the work.
Impact
Medium - Extra work to undo changes
Claude Code Version
2.1.141 (Claude Code)
Platform
Anthropic API
Additional Context
- The instruction lives in
~/.claude/CLAUDE.md(global user config), not a project-level file, so it applies to all projects. - The behavior happens consistently regardless of which project or task is being worked on.
- Claude will sometimes verbally acknowledge the rule mid-session, then violate it anyway at the end of the same or next task.
- The instruction is explicit and unambiguous: "Never create a git commit or push to remote unless the user explicitly asks in their current message."
- This is a trust/safety issue: auto-committing creates unwanted git history and auto-pushing can affect shared remotes without the user's knowledge.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗