A shell command approved in Claude Code with “Yes, and don’t ask again” may be saved with its full text in .claude/settings.local.json. If the command contains a credential and that file is committed to a public GitHub repository, the credential may be exposed. The reported pathway involves a project settings file, not every message sent to Claude Code.

How the approval can put a credential at risk

The path from a Claude Code command approval to possible credential exposure, followed by distinct measures for addressing it.
A flow from approving a shell command to saving the project settings file and, if that file enters a public GitHub repository, possible credential exposure; separate actions address prevention, history, and exposed credentials.

The “Yes, and don’t ask again” choice can create an allow rule containing the full shell command. A password or API token typed directly into that command may therefore be stored as plain text in the project’s settings file, according to TechSpot’s account of the issue.

TechSpot also reported that Claude Code adds the file to a developer’s global Git ignore configuration. That setting belongs to the individual developer’s local Git setup; a different machine does not necessarily inherit it. The project’s own .gitignore is a separate place to add a rule for the file.

What the reported repository findings say

In a report published November 10, 2026, TechSpot attributed to Apiiro findings of .claude/settings.local.json in more than 100,000 public repositories and secrets in about 1,100 repositories across 63 organizations. TechSpot also reported that gitleaks and TruffleHog missed 215 credentials in the findings. Those figures show why a scanner alone may not catch every credential in a repository.

What the Claude Code team said

TechSpot reported that Boris Cherny, a Claude Code team member, said the team was considering ways to prevent or improve the issue. The report also described a concern that auto mode might still save sensitive commands; Cherny acknowledged that concern.

What to do if the file reached a public repository

Community members recommend adding .claude/settings.local.json to the project’s .gitignore to help prevent future tracking, then checking the repository’s history for earlier commits. Removing the current file does not erase copies in forks made before cleanup. If a credential was exposed, rotate it: an ignore rule can help prevent another commit, but it does not invalidate a credential already exposed.

Prevent future tracking and respond to past exposure separately: check the repository history, then rotate any credential that was exposed.