◉CLAUDE LABJP
●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 48 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows how to stop a streaming call midway so a closed tab stops being billed●WORKTREE — Running claude --worktree on one repo in parallel: what to settle first, as one write-up lays it out●NEW — Stop making it reread the whole notes file: look up one section by number●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 48 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows how to stop a streaming call midway so a closed tab stops being billed●WORKTREE — Running claude --worktree on one repo in parallel: what to settle first, as one write-up lays it out●NEW — Stop making it reread the whole notes file: look up one section by number
Articles/Claude Code
⟐ Claude Code/2026-10-13Intermediate

The Same Approval Prompt for 'cd, git add, git commit' Every Time — Following It to a Design Choice, Not a Missing Setting

With a compound command like cd /path && git add && git commit, Claude Code keeps asking for approval even with allow rules in place. Reading the official permissions page next to a GitHub report shows that cd combined with git prompts by design. Here is how to tell, in what order to check, and four ways to cut the prompts.

Claude Code261Permissions7Bash5Troubleshooting20

I was fixing my own app late one evening, and every time I asked for a commit, the same approval screen appeared — even though Bash(git add *) and Bash(git commit *) were both in my allow rules. After about ten presses of "Yes" one evening, my hand stopped.

Looking closer, the prompt wasn't asking about git add or git commit. It was asking about cd.

What I'd like to say first is that this is often not a typo in your allow rules. I could only draw the line after rereading the official permissions page, and I'll write down the path I took.

How to recognize it

If all three of these are true, I'd suspect the same cause.

  • Claude emits one chained line such as cd /path/to/repo && git add ... && git commit ....
  • The prompt is about cd, or asks about the whole command.
  • Choosing "Yes, and don't ask again" doesn't help: the next run shows the same screen.

There is a matching report on GitHub (anthropics/claude-code, issue 28240): on version 2.1.52, on Windows, cd /some/path && git add file && git commit kept asking for cd:* and the approval couldn't be saved for the session. The reporter says earlier versions prompted for git add and git commit instead.

What the official docs say (checked October 13, 2026)

The permissions page has a section on compound commands. Four points stood out.

TopicWhat it says
SeparatorsSplit on &&, ||, ;, |, |&, & and newlines; each subcommand is matched against the rules on its own
"Don't ask again"Saves a rule per subcommand that needed approval, not one rule for the whole string (up to 5 rules per compound command)
cd aloneA cd inside the working directory or an additional directory counts as read-only; cd packages/api && ls runs without a prompt if each part qualifies on its own
cd with gitIf the cd changes into a different directory, it prompts even when each part is read-only, because running git in a new directory can execute that directory's hooks. A cd that resolves to the current working directory is a no-op and doesn't prompt

So with cd /somewhere-else && git add ..., the combination itself is what gets the prompt, however complete your git rules are. What the issue reported as a bug is now explained in the docs as intended behavior. Whether the behavior at the time of that report matches today's, I haven't verified myself.

One more case: cd combined with a redirect (for example cd app; grep -r pattern . 2>/dev/null) prompts if the redirect target's directory can't be determined. /dev/null is the exception because it doesn't depend on the working directory.

The order I check things in

When a prompt appears, I go through these in order.

  1. Read which command is being asked about. If it's cd rather than git, the "cd with git" row is the likely match.
  2. Check whether the cd target is the working directory itself. If not, that's your cause.
  3. If it is and you still get prompted, check for a trailing && with nothing after it, a command over 10,000 characters, or an unquoted glob. All of these fall on the "can't parse it, so ask" side.
  4. If none of that explains it, open /permissions and look at the spelling of the saved rules.

Four ways to cut the prompts

1. Start Claude Code inside the repository you want to work in

This felt the most reliable. The directory you start in is the working directory, so a cd to that directory isn't a prompt trigger. If you work across several repositories, I'd split sessions per repository.

2. If you need another directory, add it up front

When you must touch a repository outside the working directory, add it first with --add-dir or additionalDirectories in settings. The docs say a cd into an additional directory is read-only too. But as the table shows, a cd-plus-git move into a different directory may still prompt, even for an added one. I'd test that once before relying on it.

3. Have the commands run separately instead of chained

Skip cd, and run git add and git commit inside the repository as separate commands. Note that alternate forms like git -C <path> add ... may not match your rules: the docs show that a deny rule for Bash(git push *) doesn't catch git -C . push. A different form isn't guaranteed to match the same rule. If you switch forms, add allow rules in the same form.

4. Put it in CLAUDE.md, but don't expect too much

Writing "don't use cd in compound commands" in CLAUDE.md has been tried in the issue comments. One person wrote it in capitals and in memory files and reported only about a 50% reduction. I'd treat it as something that won't be followed every time.

The comments also suggest a PreToolUse hook that looks at the whole command and returns an allow. One comment adds a warning, though: if a hook auto-allows cd x && <read-only> chains, it should also deny destructive chains like cd x && rm -rf ... as its mirror image — otherwise the fast lane becomes a dangerous lane. That is the point I agreed with most.

What I'd avoid

My first thought was that adding Bash(cd *) to allow would quiet things down. But if the prompt comes from the cd-with-git combination, allowing cd doesn't change how that combination is treated, as far as I can read. And a broad allow rule is how you end up not knowing what you permitted.

Don't widen permissions to reduce the number of prompts. I cut the prompts by changing where the work happens, and keep the permissions narrow.

The next time the approval screen appears, read the command it names, character by character — is it git or cd? That alone will tell you whether to touch your settings or change where you start the session.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

⟐ Claude Code2026-05-20
Claude Code Says 'All Tests Pass' but CI Goes Red — Designing Around Exit Code Pitfalls
Locally, Claude Code reports 'all tests pass.' You push it, and GitHub Actions turns red within minutes. The root cause is usually not Claude Code itself but how the shell and the test runner interpret exit codes. Here is a practical, experience-backed walkthrough.
⟐ Claude Code2026-09-10
When Every Request Fails With Not signed in to the Cloud gateway, Check the Version Before the Config
A Claude Code 2.1.265 regression broke every request for gateway and proxy setups. I use it as an excuse to build a small snapshot of the auth input surface, so the next time something breaks you can tell config from version in seconds.
⟐ Claude Code2026-09-05
My deny rule was watching a filename, not the routes that reach it
One line in deny let several other spellings of the same file walk right past. Here is the small matrix I build to list every route to a protected file, and how I re-check it on upgrade day.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links