Ray's Knowledge Base
Unlock

git add -A silently skips a file the global ignore lists, such as AGENTS.md

PitfallVerified 30 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

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 --stat showed only a deletion of CLAUDE.md, and the repository tracked no notes file. git check-ignore -v named the global ignore. After !AGENTS.md in the repository .gitignore, the next git add -A staged it.
  • 2026-10-30, a docs folder on macOS: docs/agents.md stayed untracked after git add docs while 36 other pages were committed. git check-ignore -v docs/agents.md named the global AGENTS.md line. Renaming the page to docs/skills.md let it commit.