Skip to content

Bug: CLAUDE.md files created inside .git directory causing git pull failures #734

@moyuu-az

Description

@moyuu-az

📝 Manual Bug Report

Bug Description

CLAUDE.md files are being created inside the .git/ directory structure, which causes git pull to fail with the error:

fatal: bad object refs/CLAUDE.md
error: github.com:xxx/xxx.git did not send all necessary objects

The following files were found inside .git/:

  • .git/refs/CLAUDE.md
  • .git/refs/tags/CLAUDE.md
  • .git/refs/remotes/origin/CLAUDE.md
  • .git/logs/CLAUDE.md
  • .git/CLAUDE.md

Git interprets these as invalid references, breaking git operations.

Steps to Reproduce

  1. Use Claude Code with claude-mem plugin in a git repository
  2. Work normally with various tool calls (Read, Edit, Bash, etc.)
  3. Attempt git pull
  4. Observe the error: fatal: bad object refs/CLAUDE.md

Expected Behavior

The .git/ directory should be completely excluded from CLAUDE.md auto-generation. According to the documentation, "The project root (folders containing a .git directory) is excluded from auto-generation" - but the .git/ directory itself should also be excluded.

Environment

  • Claude-mem version: 9.0.1
  • Claude Code version: 2.1.9
  • OS: macOS 26.1 (Tahoe)
  • Platform: Apple Silicon (arm64)

Workaround

Manually removing the files resolves the issue:

find .git -name "CLAUDE.md" -delete

Setting CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED to "false" in ~/.claude-mem/settings.json may prevent future occurrences.

Additional Context

  • The .gitignore already contains CLAUDE.md, but that doesn't prevent files from being created inside .git/
  • This appears to be a path filtering issue where .git/ subdirectories are not being excluded
  • Multiple CLAUDE.md files (158+) were also created throughout the project in various subdirectories

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions