[BUG] Claude Code Creates ~/.config/git/ignore Without Permission

Resolved 💬 7 comments Opened Oct 24, 2025 by srgvg Closed Jan 17, 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?

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

  1. Configuration Conflict: Creates confusion when users have existing core.excludesfile settings
  2. Unexpected Behavior: Global git ignore behavior changes without user awareness
  3. File Precedence Issues: ~/.config/git/ignore is checked by git even when core.excludesfile points elsewhere
  4. 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:

settings.local.json

Option 2: Respect Existing Configuration

  1. Check if core.excludesfile is set
  2. If set, append to that file (with permission)
  3. If not set, ask user permission before creating global ignore file

Option 3: Document and Provide Control

  1. Add a setting to control this behavior
  2. Document this in the setup/onboarding process
  3. 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:

  1. Delete ~/.config/git/ignore
  2. Add **/.claude/settings.local.json to their own global gitignore file
  3. 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:

  1. Respect the user's existing core.excludesfile configuration
  2. Ask permission before modifying global git settings
  3. Use project-level .gitignore files (e.g., .claude/.gitignore) instead of global configuration
  4. 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

  1. Install Claude Code v2.0.26
  2. Run Claude Code in any git repository
  3. Check for the existence of ~/.config/git/ignore

Expected Behavior

Claude Code should:

  1. Respect the user's existing core.excludesfile configuration
  2. Ask permission before modifying global git settings
  3. Use project-level .gitignore files (e.g., .claude/.gitignore) instead of global configuration
  4. 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_

View original on GitHub ↗

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