Preflight Checklist
What's Wrong?
Bug Report: Claude Code Creates ~/.config/git/ignore Without Permission
Summary
Claude Code v2.0.26 automatically creates ~/.config/git/ignore to globally exclude .claude/settings.local.json without asking for user permission. This modifies global git configuration outside of Claude Code's own directories.
Environment
- Claude Code Version: 2.0.26
- Operating System: Debian Linux 6.12.38+deb13-amd64
- Git Version: 2.47.3
- Installation Method: npm/nvm (Node v22.17.1)
Impact
User Impact
- Configuration Conflict: Creates confusion when users have existing
core.excludesfile settings
- Unexpected Behavior: Global git ignore behavior changes without user awareness
- File Precedence Issues:
~/.config/git/ignore is checked by git even when core.excludesfile points elsewhere
- Trust Violation: Modifying global system configuration without permission
Technical Impact
Git checks both locations:
~/.config/git/ignore (XDG config, created by Claude Code)
- The file specified in
core.excludesfile (user's choice)
This can lead to unexpected ignore behavior across all git repositories on the system.
Suggested Fix
Option 1: Use Project-Level Gitignore (Recommended)
Create .claude/.gitignore in Claude Code's own directory containing:
Option 2: Respect Existing Configuration
- Check if
core.excludesfile is set
- If set, append to that file (with permission)
- If not set, ask user permission before creating global ignore file
Option 3: Document and Provide Control
- Add a setting to control this behavior
- Document this in the setup/onboarding process
- Allow users to opt-out
Additional Context
The pattern **/.claude/settings.local.json is valid and useful for preventing accidental commits of local settings. However, the method of implementation (silent global git configuration modification) is problematic.
Workaround
Users can:
- Delete
~/.config/git/ignore
- Add
**/.claude/settings.local.json to their own global gitignore file
- Set up file monitoring to detect if Claude Code recreates it
Related Files
- Created:
~/.config/git/ignore
- Referenced in code: Settings for
settings.local.json throughout Claude Code
- User's existing config:
~/.gitignore (or custom core.excludesfile)
Request
Please consider one of the suggested fixes above, prioritizing user consent and configuration transparency. Development tools should respect existing user configurations and request permission before modifying global system settings.
What Should Happen?
Expected Behavior
Claude Code should:
- Respect the user's existing
core.excludesfile configuration
- Ask permission before modifying global git settings
- Use project-level
.gitignore files (e.g., .claude/.gitignore) instead of global configuration
- Document this behavior if it's intentional
Error Messages/Logs
## Evidence
### Audit Log Evidence
Using Linux audit subsystem, I captured the exact moment the file was created:
time->Wed Oct 22 14:57:29 2025
type=PROCTITLE msg=audit(1761137849.122:139187): proctitle="claude"
type=PATH msg=audit(1761137849.122:139187): item=1 name="/home/serge/.config/git/ignore" nametype=CREATE
type=SYSCALL msg=audit(1761137849.122:139187): comm="claude" exe="/home/serge/.nvm/versions/node/v22.17.1/bin/node"
type=CWD msg=audit(1761137849.122:139187): cwd="/home/serge/src/autops/wharf/ADR"
### File Details
$ stat ~/.config/git/ignore
File: /home/serge/.config/git/ignore
Size: 31
Modify: 2025-10-22 14:57:29.122870542 +0200
Birth: 2025-10-22 14:57:29.122870542 +0200
$ cat ~/.config/git/ignore
**/.claude/settings.local.json
### Existing Git Configuration
$ git config --global --get core.excludesfile
~/.gitignore
The user already has a global excludes file configured, but Claude Code ignores this setting and creates its own file in the XDG config location.
Steps to Reproduce
Steps to Reproduce
- Install Claude Code v2.0.26
- Run Claude Code in any git repository
- Check for the existence of
~/.config/git/ignore
Expected Behavior
Claude Code should:
- Respect the user's existing
core.excludesfile configuration
- Ask permission before modifying global git settings
- Use project-level
.gitignore files (e.g., .claude/.gitignore) instead of global configuration
- Document this behavior if it's intentional
Actual Behavior
Claude Code automatically creates ~/.config/git/ignore containing:
**/.claude/settings.local.json
This file is created without warning or consent, potentially conflicting with existing git exclude configurations.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.0.26 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
No response
Preflight Checklist
What's Wrong?
Bug Report: Claude Code Creates ~/.config/git/ignore Without Permission
Summary
Claude Code v2.0.26 automatically creates
~/.config/git/ignoreto globally exclude.claude/settings.local.jsonwithout asking for user permission. This modifies global git configuration outside of Claude Code's own directories.Environment
Impact
User Impact
core.excludesfilesettings~/.config/git/ignoreis checked by git even whencore.excludesfilepoints elsewhereTechnical Impact
Git checks both locations:
~/.config/git/ignore(XDG config, created by Claude Code)core.excludesfile(user's choice)This can lead to unexpected ignore behavior across all git repositories on the system.
Suggested Fix
Option 1: Use Project-Level Gitignore (Recommended)
Create
.claude/.gitignorein Claude Code's own directory containing:Option 2: Respect Existing Configuration
core.excludesfileis setOption 3: Document and Provide Control
Additional Context
The pattern
**/.claude/settings.local.jsonis valid and useful for preventing accidental commits of local settings. However, the method of implementation (silent global git configuration modification) is problematic.Workaround
Users can:
~/.config/git/ignore**/.claude/settings.local.jsonto their own global gitignore fileRelated Files
~/.config/git/ignoresettings.local.jsonthroughout Claude Code~/.gitignore(or customcore.excludesfile)Request
Please consider one of the suggested fixes above, prioritizing user consent and configuration transparency. Development tools should respect existing user configurations and request permission before modifying global system settings.
What Should Happen?
Expected Behavior
Claude Code should:
core.excludesfileconfiguration.gitignorefiles (e.g.,.claude/.gitignore) instead of global configurationError Messages/Logs
Steps to Reproduce
Steps to Reproduce
~/.config/git/ignoreExpected Behavior
Claude Code should:
core.excludesfileconfiguration.gitignorefiles (e.g.,.claude/.gitignore) instead of global configurationActual Behavior
Claude Code automatically creates
~/.config/git/ignorecontaining:This file is created without warning or consent, potentially conflicting with existing git exclude configurations.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.0.26 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
No response