Omniscio

OmniscioGuidesIgnore files

Claude Code ignore files: what it skips, and what it does not

People ask whether Claude Code respects their .gitignore, and the honest answer is that it depends which tool is looking. The content search skips gitignored files, the file-glob tool does not, and the file people expect to fix that, a .claudeignore, is not supported.

This page owns what gets skipped, how to make a path off-limits to Claude's file tools, and what still gets past them. The monorepo guide applies the same levers to per-package work, and the context window guide covers what each file read costs once it lands.

Sources read November 25, 2026. By the Omniscio team. Updated .

What Claude Code ignores on its own

Two of Claude Code's built-in tools are the ones that search your files: Grep looks inside files for a pattern, and Glob finds files by name. Grep respects .gitignore by default, so paths already listed there, such as node_modules/, dist/ and build/, stay out of search results. When Claude needs a gitignored file anyway, it passes that file's path directly.

Glob is the exception. It does not respect .gitignore by default, so it finds gitignored files alongside tracked ones. The switch is a double negative: by default Glob ignores nothing, and setting the variable to false is what makes it obey the patterns. Set it before launching Claude Code.

export CLAUDE_CODE_GLOB_NO_IGNORE=false

Which of those two tools you have depends on the platform. Glob and Grep are the default tool set on Windows. On macOS, Linux and WSL, Claude Code leaves both out, and Claude searches with find and grep through the Bash tool instead, so those searches arrive as Bash calls for your hooks and permission rules.

Neither variable touches the @ file picker, the list that opens when you type @ to point Claude at a file. It has its own switch, respectGitignore, shown in /config as Respect .gitignore in file picker. It leaves out files that match .gitignore patterns unless a settings file turns it off, in which case the picker includes them.

The .claudeignore that does nothing

Other tools take an ignore file, so people create a .claudeignore and expect it to work. If your project has one, it has no effect. Its entries have to move into Read deny rules.

The difference matters. A gitignore entry filters the content search and the file picker; a deny rule stops Claude's file tools from opening the path, which covers the case where Claude already has the path in hand.

A cousin of the same mistake is the ignorePatterns settings key, which Anthropic marks as deprecated in favour of permissions.deny. If an old settings file on your machine still carries it, that is why a pattern you wrote there is not being applied.

Excluding a checked-in path with a deny rule

For paths that are checked in, such as a vendored SDK or committed generated code, add Read deny rules in permissions.deny. The rules block Claude's file tools from opening those files.

{
  "permissions": {
    "deny": [
      "Read(./**/dist/**/*)",
      "Read(./**/build/**/*)",
      "Read(./**/*.generated.*)",
      "Read(./**/vendor/**/*)"
    ]
  }
}

The patterns above deliberately end with /**/* rather than /**: that covers every file inside the directory while leaving the directory itself reachable, so Claude can still list it or change into it with ls dist or cd build. A vendored SDK is the reason this list differs from the gitignore one: dist/ and build/ are usually ignored and never committed, and the deny rules are for whatever is committed and the search still sees.

Here is the limit worth knowing before you rely on it. A deny rule does not apply to a command that reads files without naming them, such as grep -r pattern . run from the folder that holds the file, and it does not apply to a subprocess that opens files itself, such as a Python or Node script. A Bash search over a directory that contains denied files still includes them in its output. For enforcement at the operating-system level, Anthropic points at the sandbox.

Read and Edit rules use gitignore pattern syntax, and a bare filename matches at any depth under the current directory, so Read(.env) and Read(**/.env) are the same rule. Neither blocks a .env in a parent directory or in another project.

Permission rules sit in three lists, allow, ask and deny. In any of them, a pattern that starts with ! is a gitignore negation. It carves out the paths it matches from the rules listed before it: Read(*.env) followed by Read(!sample.env) blocks every file whose name ends in .env at any depth, except sample.env. A ! rule listed first carves nothing out.

Which settings file the rule belongs in

Where the rule lives decides who it covers, and the shared file is narrower than people assume. Committed to the .claude/settings.json of the folder you start Claude in, it covers everyone working in that folder. Anthropic's monorepo advice is explicit that the file is not inherited from parent directories, so a session started in a package needs the rules in that package's .claude/ too.

In .claude/settings.local.json the rule covers only you, and in managed settings, the policy file an administrator deploys, it covers every session on the machine and cannot be overridden by user or project settings.

Two catches apply to the local file. Relative patterns such as Read(./**/vendor/**/*) anchor at the session's current working directory, not the repository root, so if you start sessions from subdirectories, write those rules as // absolute paths, such as Read(//absolute/path/to/repo/**/vendor/**/*). The leading double slash is what makes a path absolute in a rule; a single leading slash does not, which is the mistake to watch for.

If a rule you wrote seems to do nothing, the question is usually which file won. The config debugging guide covers how to see which settings actually applied, and the sandbox guide covers the enforcement that survives a Bash search.

The local file has its own git story too. The first time Claude Code writes .claude/settings.local.json in a repository that does not already ignore it, it adds **/.claude/settings.local.json to your global git excludes, so the file stays out of your commits. If you created the file by hand, add it to .gitignore yourself.

Two neighbours people also ask about

Another team's CLAUDE.md

When you start Claude from a repository root, each subdirectory's CLAUDE.md can load on demand during the session. The claudeMdExcludes setting skips specific files by path or glob pattern so they never load, with one exception: a managed CLAUDE.md file cannot be excluded this way. Patterns are matched against absolute paths, so a relative-looking entry needs a leading **/ to match anywhere in the tree. The monorepo guide walks through the package-level patterns.

A personal instructions file

CLAUDE.local.md is the personal instructions file: it loads alongside CLAUDE.md and is treated the same way, but add it to .gitignore so your private notes are not committed. With CLAUDE_CODE_NEW_INIT=1 set, running /init and choosing the personal option does that for you; the /init guide covers that flow.

Sources

Every line on this page rests on one of these. The date beside each one is the day we read it.

  • Tools reference, for the Glob and Grep behavior on .gitignore, which tools are in the default set on which platform, and CLAUDE_CODE_GLOB_NO_IGNORE. Read November 25, 2026.
  • Environment variables, for CLAUDE_CODE_GLOB_NO_IGNORE and its separation from the @ file picker. Read November 25, 2026.
  • All settings, for respectGitignore, the permissions.deny limits, and the deprecated ignorePatterns key. Read November 25, 2026.
  • Configure permissions, for the .claudeignore sentence, the Read and Edit pattern syntax, the ! negation and the Bash and subprocess limits. Read November 25, 2026.
  • Set up Claude Code in a monorepo or large codebase, for the deny-rule example, the settings scopes, the working-directory anchor and the Bash caveat. Read November 25, 2026.
  • Settings files and precedence, for the global git excludes entry Claude Code writes for settings.local.json. Read November 25, 2026.
  • How Claude remembers your project, for claudeMdExcludes, its managed-file exception, its absolute-path matching, and CLAUDE.local.md. Read November 25, 2026.

No exclusion was set up or run for this page. Every behavior, setting and pattern is transcribed from those pages.

Common questions

Does Claude Code respect .gitignore?

Partly. Content searches through the Grep tool respect .gitignore and skip gitignored files, and the @ file picker leaves them out by default. The Glob tool does not: it finds gitignored files alongside tracked ones unless you set CLAUDE_CODE_GLOB_NO_IGNORE=false. On macOS, Linux and WSL, neither Glob nor Grep is in the default tool set, and Claude searches with find and grep through Bash instead.

Is there a .claudeignore file?

Not a supported one. A file with that name has no effect. Move its entries into Read deny rules in permissions.deny, which block Claude's file tools from reading a path.

How do I stop Claude Code reading a checked-in folder?

Add a Read deny rule for it in permissions.deny, such as Read(./**/vendor/**/*), in the .claude/settings.json of the folder you start Claude in, in .claude/settings.local.json for yourself alone, or in managed settings to enforce it on every session on the machine.

Why does Claude Code still read a gitignored file?

Gitignore filters the content search and the file picker, not every way a file can be reached. Glob lists gitignored files by default, Claude can pass a gitignored path directly, and a Bash search such as grep -r or find over the folder still includes denied files too. The sandbox is what enforces a path at the OS level.

Where should the exclusion go if I start Claude in a subdirectory?

Project settings are not inherited from parent directories, so a root .claude/settings.json does not cover a session started in a package. Commit a copy in the package's .claude/, and write local rules as // absolute paths, because a relative pattern in settings.local.json anchors at the session's working directory.

Every session, one window

Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness: Claude Code, Codex, OpenCode, Devin, Pi, and Hermes all supported.