Claude Code repeatedly appends duplicate entries to ~/.config/git/ignore

Resolved 💬 4 comments Opened Aug 30, 2025 by mrclrchtr Closed Jan 5, 2026

Bug Description

Claude Code continuously appends the same ignore pattern to ~/.config/git/ignore, creating duplicate entries for **/.claude/settings.local.json. This happens repeatedly during normal usage, causing the file to grow with identical lines.

Environment Info

  • Platform: darwin (macOS)
  • OS Version: Darwin 24.6.0
  • Claude Code Version: Latest
  • Terminal: Various (affects all terminals)

Steps to Reproduce

  1. Use Claude Code in any project
  2. Check ~/.config/git/ignore file
  3. Notice multiple identical entries for **/.claude/settings.local.json
  4. Continue using Claude Code
  5. File grows with more duplicate entries

Expected Behavior
The ignore pattern **/.claude/settings.local.json should only appear once in the file, or Claude Code should check if the pattern already exists before adding it.

Actual Behavior
Multiple identical lines are appended to the file:

**/.claude/settings.local.json
**/.claude/settings.local.json
**/.claude/settings.local.json

Impact

  • Cluttered git ignore configuration
  • Potential conflicts with tools like chezmoi that manage dotfiles
  • File grows unnecessarily over time

Related Issues
This issue is related to #5880, which reported the same problem but was incorrectly closed as a duplicate of #3523. The issues are fundamentally different:

  • #3523: Hook configuration duplication in memory causing performance issues with multiple process executions
  • #5880 & This issue: File-level duplication where identical text lines are repeatedly appended to ~/.config/git/ignore

As correctly noted by @speto in #5880, these represent distinct bugs with different root causes that require separate fixes.

Suggested Fix
Before appending to ~/.config/git/ignore, Claude Code should:

  1. Check if the pattern already exists in the file
  2. Only add the pattern if it's not already present
  3. Alternatively, use a more robust method to ensure the ignore pattern is present without duplication

Additional Context
This affects users of dotfiles management tools (like chezmoi) who track their global git configuration, as the repeated modifications create conflicts and require manual cleanup.

View original on GitHub ↗

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