Gemini CLI gitignore troubleshooting for one missing fixture
Diagnose Gemini CLI gitignore filtering with two JSON fixtures. Use Git and direct @ attachments to recover the intended file while its sibling stays filtered.
Your test fixture opens in an editor, but Gemini CLI skips it when you use @ to attach it. A Gemini CLI gitignore check starts with two files in the same directory. Give one an exact exception and keep the other excluded. Git can show the rule that classifies each path. Gemini CLI can show which file it reads into the prompt.
The expected result is that generated/cases/keep.json attaches and generated/cases/drop.json is skipped, with both files still on disk. Use Git, a working interactive Gemini CLI installation at v0.72.0 or later, and a disposable repository containing only synthetic data. The setup uses a POSIX-style shell. You can also initialize the scratch repository and create the files with an editor using the tree and contents below. If your fixture is absent or its checkout contains a pointer in place of the expected data, start with the checkout repair guide. Git LFS Checkout: Recover and Verify a Missing Test Fixture
Build a two-file fixture with one narrow exception
- Start in a writable directory outside your working repositories. The setup creates a new child named
fixture-scope-01. The subshell stops if that name already exists. If it does, choose another parent directory for the example. In an ordinary shell without a Git directory override,git initcreates the local.gitdirectory and an initial branch with no commits. Git init reference - Run the complete setup block. The root
.gitignorecontains only a comment. The wildcard lives ingenerated/.gitignore, and the exception lives ingenerated/cases/.gitignore. The upstream parser regression test uses the same relative layout, with a wildcard in a non-root ignore file and a negation immediately inside the affected directory. Gemini CLI patch and regression tests - After setup succeeds, enter
fixture-scope-01and open both JSON files in your editor. Confirm that each contains onemarkerfield and that the values differ. Keep the marker values out of the prompt. You can then use the response as a secondary content check against the paths reported by the client.
(
set -e
mkdir fixture-scope-01
cd fixture-scope-01
git init
mkdir -p generated/cases
printf '%s\n' '# Disposable fixture-scope-01 repository' > .gitignore
printf '%s\n' 'cases/**' > generated/.gitignore
printf '%s\n' '!/keep.json' > generated/cases/.gitignore
printf '%s\n' '{"marker":"violet-otter-73f2"}' > generated/cases/keep.json
printf '%s\n' '{"marker":"orange-heron-91c4"}' > generated/cases/drop.json
)
cd fixture-scope-01
The authored tree is below. Leave both JSON files untracked. The baseline has no .geminiignore and needs a project settings file only if you need to explicitly request the filtering defaults later.
fixture-scope-01/
├── .git/
├── .gitignore
└── generated/
├── .gitignore
└── cases/
├── .gitignore
├── drop.json
└── keep.json
Read each pattern from the directory containing its ignore file. In generated/.gitignore, cases/** matches everything inside generated/cases/ at any depth. In generated/cases/.gitignore, the slash in !/keep.json anchors the exception to the keep.json directly beside that ignore file. The ! makes it a negation. The sibling has no matching exception, so the wildcard still applies to it. Git ignore pattern rules
Keep the distinction between a directory and its contents when adapting the example. Replacing cases/** with cases/ in generated/.gitignore would exclude the directory itself. Git stops examining an excluded parent, so its child ignore rule cannot re-include the file. Moving cases/** into the root without adjusting the path changes the directory the rule addresses. When translating a rule into a different ignore file, work out its new relative path before testing. Git ignore pattern rules
The nested .gitignore needs to be present when the tool examines the tree. If your generator recreates cases/ from scratch, a hand-edited child rule can disappear on the next generation. Check where your team maintains the generator inputs and whether the resulting ignore file is expected to be generated or distributed with the repository. Keep that decision with the rule change so a second checkout can recreate the conditions you verified. Run the two-path check again after regenerating the fixtures. This also catches a generator that changes the target filename while preserving the old exception.
Read Git’s verdict for each path
- At the scratch repository root, run the first command below. Read the source file, line number and pattern for each path. The displayed results are illustrative expected observations for the supplied tree. Local exclude sources may affect your output. Git check-ignore reference
- Run the second command to check the parents. With this fixture and no other matching excludes, expect both directory records to have empty source, line and pattern fields. A directory record containing an exclusion gives you a concrete rule to inspect before changing the child exception. Git check-ignore reference
- If either file produces an unexpected result, open the ignore file named on that line. Resolve the pattern from that file’s directory. For a repository-local or global exclude, interpret the pattern from the working-tree root. Keep both records together when you rerun the commands. A repair has to give the desired classification for the target and preserve the intended classification for the sibling. Git ignore pattern rules
git check-ignore -v --no-index generated/cases/keep.json generated/cases/drop.json
git check-ignore -v --non-matching --no-index generated/ generated/cases/
Illustrative output for the first command has a tab before each pathname.
generated/cases/.gitignore:1:!/keep.json generated/cases/keep.json
generated/.gitignore:1:cases/** generated/cases/drop.json
The first line shows a matching negation. Git includes the leading ! in verbose output, so the presence of a line for keep.json indicates that Git found the exception. The second line contains an ordinary exclusion. The command’s documented exit status of zero means that at least one supplied path is ignored. Use the individual records to tell which rule applies to each file. A script or terminal that shows only the shared exit status discards that distinction. Git check-ignore reference
--no-index makes this a diagnostic of the ignore patterns even if you later use the command on a path that already has an index entry. Tracked files are outside Git’s normal ignore handling. If you use this diagnostic on a tracked fixture in your working repository, treat the result as the rule classification and keep its tracking state in mind when interpreting other Git behavior. The scratch example leaves the index out of the question by creating ordinary untracked files. Git check-ignore reference · Git ignore pattern rules
The parent check uses --non-matching so that a path with no matching rule gets a record, too. An empty record for generated/cases/ and a matching wildcard for generated/cases/drop.json are compatible. They show the two different things the example asks Git to classify. If a record points to .git/info/exclude or an absolute path from core.excludesFile, inspect that source before touching a checked-in pattern. A teammate can have identical .gitignore files and a different local rule for a parent. Compare the reported paths and the deciding lines when the result differs across machines. Git check-ignore reference · Git ignore pattern rules
Compare two direct Gemini CLI attachments
- From the scratch root, launch
geminiand enter/aboutin the interactive prompt to see the running version. The December 2, 2026 release of v0.72.0 lists the nested.gitignorenegation fix underdir/**. The merged change explains how the previous optimization could synthesize a directory exclusion and prune the directory before reading its child rule. The fix checks for a child negation before adding that synthetic exclusion. Gemini CLI command reference · v0.72.0 release notes · Merged pull request - Enter the prompt below in a fresh conversation. If your paste settings escape the at signs, type the two
@characters. Submit both exact paths in the same turn so they share the workspace and effective filtering settings. Leave a space between the two references and end the line with the second.jsonname. Gemini CLI command reference · Gemini CLI configuration reference - Inspect the client file-read status for the paths it processed. The illustrative baseline expects an attachment read of
generated/cases/keep.jsonand a skip forgenerated/cases/drop.json. If debug messages are visible, the tagged processor can reportGit-ignored:with the skipped path. Keep any later model-initiated read separate from the client’s initial attachment event. Tagged v0.72.0 attachment processor
Report the marker from each JSON attachment supplied with this message. Use the attachments already included and do not call tools. If there is no attached content for a path, report unavailable. @generated/cases/keep.json @generated/cases/drop.json

The exact paths exercise direct file attachment. A directory @ reference can resolve to a path that the model can inspect using tools. A direct file reference can be read by the client through read_many_files, which inserts file content into the query before the model responds. Read the status for this initial operation and match the full path to the intended file. A later read or a similarly named file elsewhere in the workspace gives you a different observation. Gemini CLI command reference · Tagged attachment processor
A skipped @ reference can still appear as text in the outgoing query. The tagged implementation can carry the original path token even when the filter omits its file content. If the model repeats drop.json by name, that tells you it saw the name. The marker is what distinguishes the content of this synthetic fixture. Use the client read result as the primary observation, with violet-otter-73f2 in the response as corroboration if the conversation was fresh and the model did no later reads. If the client status is ambiguous, record that the observation is inconclusive. Restart from the scratch root and repeat before inferring which rule applied. Tagged attachment processor
The following table gives illustrative expected observations for the exact fixture. The baseline assumes the paths are readable, both ignore filters are enabled and no additional rule changes the outcome.
| Input | Action | Expected result |
|---|---|---|
task:fixture-scope-01 with keep.json set to violet-otter-73f2 and drop.json set to orange-heron-91c4 |
Run git check-ignore -v --no-index generated/cases/keep.json generated/cases/drop.json at the repository root. |
Git reports generated/cases/.gitignore:1:!/keep.json for the intended fixture and generated/.gitignore:1:cases/** for the ignored sibling. |
task:fixture-scope-01 with both files on disk and both CLI filters enabled |
Submit the probe containing @generated/cases/keep.json @generated/cases/drop.json in a fresh interactive session. |
The client reads keep.json and supplies violet-otter-73f2. drop.json stays out of the attachment content. |
task:fixture-scope-01 with the same Git rules and /generated/cases/keep.json added to root .geminiignore |
Restart Gemini CLI and submit the identical two-path probe. | Git reports the baseline patterns. The direct attachment path skips keep.json under Gemini filtering and drop.json under Git filtering. |
If you need to compare terminals, save the initial attachment event with the /about result. This pairs the actual client operation with the binary that made it. Keep later reads separate when you share the run with someone else. The same evidence distinction applies to other agent sessions where a summary can omit the operation you need to verify. You Can’t Replay What You Can’t See
Find the filter that still disagrees
- Git excludes both files. Read the two parent records first. To rehearse this failure, add
/generated/after the comment in the scratch root.gitignoreand repeat the Git commands. Expect the root exclusion to account forgenerated/and its descendants. Remove the added line before continuing. If this is the result in a working project, identify why the parent was excluded before allowing traversal. Recheck the sibling after any authorized rule change. Git ignore pattern rules - Git re-includes
keep.jsonand the client skips it. Check the root.geminiignorefor patterns matching the file or its parents. The tagged direct attachment processor evaluates the enabled Git and Gemini checks separately. A rejection from either can skip the path. If the CLI gives a Gemini filter message, start with that ignore file and its matching rule. When you change the file, restart Gemini CLI before trying the prompt again. Gemini CLI ignore documentation · Tagged attachment processor - The client attaches both files. Check the effective value of
context.fileFiltering.respectGitIgnore. Look at the user and project settings, then account for system settings that override project settings. Inspect any configuredcontext.fileFiltering.customIgnoreFilePathswhen diagnosing a local discrepancy. The configuration reference describes these files as taking precedence over the standard ignore files. Keep custom rules outside the illustrative baseline. If the extra read happened after the model responded, record it separately from the attachment check. Gemini CLI configuration reference - The client reports a path or read error. Confirm the starting directory, the exact file paths and the running version via
/about. Openkeep.jsonlocally and check its marker again. Correct a typo or regenerate an absent scratch fixture before retrying. If a managed workspace disallows the read, bring the exact path and error to the workspace owner. That gives them the context to decide whether access should change. Gemini CLI command reference
If you need to request both documented filtering defaults explicitly, use this complete .gemini/settings.json in the scratch repository. Create its .gemini parent directory if necessary. If the file already exists, save its original contents and edit only the two keys. Both settings require a restart. Use /quit, relaunch gemini from the scratch root and check both paths again. The project file takes precedence over user settings, and a system override file can take precedence over it. If the observed behavior disagrees with the project file, resolve that difference before using the baseline to evaluate an ignore rule. Gemini CLI configuration reference · Gemini CLI command reference
{
"context": {
"fileFiltering": {
"respectGitIgnore": true,
"respectGeminiIgnore": true
}
}
}
To reproduce a Gemini-only rejection of keep.json, create a root .geminiignore containing the single line below. The leading slash anchors this rule at the scratch project root. Restart the CLI, run the same Git commands and repeat the prompt in the fresh session. Expect the same !/keep.json Git result and a Gemini-filtered skip for the target. The sibling is still subject to the Git wildcard. Delete the temporary .geminiignore and restart again when you finish this comparison. Gemini CLI ignore documentation · Tagged attachment processor
/generated/cases/keep.json
If the first run worked and the temporary rule makes both paths disappear from the client read, compare the skip reasons. Where debug messages are visible, the example gives you two paths with two different reasons in the same turn. A single change to the root .geminiignore explains the target’s new result. When you have several settings to investigate, isolate one project edit per run and record what the client actually reported before restoring it. A worked example of pairing changes to individual observations is available in the settings guide. Claude Code Disable Settings
Restore the fixture and carry the narrow fix back
- Close the scratch session with
/quit. Remove the/generated/line if you added it during the parent-directory rehearsal. Remove the temporary.geminiignoreif you created it. Delete.gemini/settings.jsonif it was created solely for the exercise, or restore its prior contents if you edited an existing file. Rerun the Git checks and, if you keep the scratch repository, reopen Gemini CLI to repeat the baseline attachment. Gemini CLI command reference - To remove the exercise entirely, exit the scratch session and move out of
fixture-scope-01. Verify the folder’s contents and remove that exact folder through your file manager. The setup block can recreate the untracked JSON files. If you keep the files and want to discard active conversation context for another prompt, use/clearin the CLI. For experiments that change ignore files or filtering settings, exit and relaunch as described above. Gemini CLI command reference · Gemini CLI ignore documentation - In the working repository, use verbose Git output to identify the rule that currently governs the target and its sibling. If a parent exclusion applies, locate its source before writing the child negation. If Git already reports the intended negation, use the CLI branch of the diagnosis. Before adapting an ignore pattern, pick an authorized synthetic sibling in the same directory that should still match the exclusion. Compare full paths in the output so a same-named fixture elsewhere cannot stand in for that sibling. Git check-ignore reference
- Repeat the two-path attachment check after applying the narrow repair in a scratch copy. Keep a record of the deciding Git lines and the initial client status in the same run. When those observations agree, check the specific working fixture’s contents before sending it in the real debugging session. If the generator owns the child ignore file, include its regeneration in the verification so the repair survives the ordinary way the fixture is created.
If you need a colleague to reproduce the discrepancy, give them the synthetic tree, the working directory used to launch the CLI and the two deciding Git lines. Describe any project or system filtering values you verified and the first client read or skip you observed. This gives them a concrete comparison even if the model words its reply differently. For another example of controlling what varies while interpreting a test, see the guide to checking an override in one session. AgentCore Model Override: Test a Second Model in the Same Session
Use the attachment event as the completion evidence for this repair. The example is complete when the initial client read contains the intended fixture and the sibling stays filtered. If the reply mentions both paths, check the attachment event again and compare the markers before treating the repair as complete. The same distinction between an operation and its summary matters when you write a finish line for an agent task. Write a Finish Line the Transcript Can Prove
Sources
- Google Gemini CLI v0.72.0 release notes
- Gemini CLI pull request 30370
- Patch and regression tests for pull request 30370
- Gemini CLI command reference
- Gemini CLI configuration reference
- Gemini CLI ignore documentation
- Git ignore pattern rules
- Git check-ignore reference
- Gemini CLI v0.72.0 attachment processor
- Git init reference

