git add -A silently skips a file the global ignore lists, such as AGENTS.md
Symptom#
A commit that should add AGENTS.md adds nothing, and nothing warns:
$ git add -A && git commit -m "notes: add AGENTS.md"
1 file changed, 1 deletion(-)
$ git ls-files | grep AGENTS.md
$
The file is on disk and git status does not list it as untracked.
On macOS the same rule also hides other files whose name differs only in case, such as docs/agents.md, because the file system ignores case. After git add docs, every page except docs/agents.md was staged, and git status --short still listed ?? docs/agents.md.
Cause#
The global excludes file (~/.config/git/ignore, or core.excludesFile) lists the name. git add -A and git add . skip ignored files without a message; only naming the file on the command line prints "The following paths are ignored".
$ git check-ignore -v AGENTS.md
/Users/$USER/.config/git/ignore:6:AGENTS.md AGENTS.md
$ git check-ignore -v docs/agents.md
/Users/$USER/.config/git/ignore:6:AGENTS.md docs/agents.md
Fix#
In a repository that must track the file, add an exception to its own .gitignore. A repository pattern overrides the global file:
!AGENTS.md
!CLAUDE.md
Then git add -A picks it up. After any commit that should add a file, check with git ls-files <file> or git show --stat HEAD, not with the exit code.
For a public repository whose contributors may have the same global rule, rename a docs page such as docs/agents.md to a name no common ignore matches (for example docs/skills.md) instead of relying on each contributor's ignore.
Evidence#
- 2026-10-01, rsrobo notes repository: two commits were reported as adding
AGENTS.md;git show --statshowed only a deletion ofCLAUDE.md, and the repository tracked no notes file.git check-ignore -vnamed the global ignore. After!AGENTS.mdin the repository.gitignore, the nextgit add -Astaged it. - 2026-10-30, a docs folder on macOS:
docs/agents.mdstayed untracked aftergit add docswhile 36 other pages were committed.git check-ignore -v docs/agents.mdnamed the globalAGENTS.mdline. Renaming the page todocs/skills.mdlet it commit.