DocsWorkflows
Working in a protected repo
Plain git for every file without a placeholder. Four Secret Sleuth commands for the handful that hold one, until remediation is done.
Which files are affected
Only files a full scan sealed. Your C# classes, templates, styles and components behave exactly as before: git add, git commit, git pull. Tracked files holding DO_NOT_COMMIT_* placeholders (typically appsettings.json, Web.config, environment.ts) are marked skip-worktree, and git refuses to stage or overwrite them. Untracked files cannot be marked skip-worktree; the pre-commit hook still blocks staged placeholders in them. status lists protected files:
SecretSleuth status
Instead of… use
| Instead of… | Use |
|---|---|
git pull | SecretSleuth pull |
git checkout <branch> | SecretSleuth branch-switch --to <branch> |
git add <protected file> | SecretSleuth stage --file <protected file> |
git update-index --no-skip-worktree | restore --file (real values back) or unfreeze --file (flag only) |
| Commit a remediated protected file | SecretSleuth stage --file <path>, then git commit |
Commit an edit to a protected file
You added a feature flag to appsettings.json. It does not show in git status, and git add fails. Stage it with Secret Sleuth, review, then commit as usual:
SecretSleuth stage --file appsettings.json # or: stage --all
git diff --cached # only your lines changed
git commit -m "Add feature flag"
stage writes your edited lines to the index, with every line you did not touch taken from HEAD. The working copy stays sealed. It refuses a file when an edited line still holds a placeholder, or when an edited line looks like a new secret. You can also use it to stage a remediation after replacing a placeholder with a safe value or reference. See stage.
Pull and switch branches
SecretSleuth pull # same branch
SecretSleuth branch-switch --to main --pull # other branch, then pull
Both put the committed content back on protected files, stash only your genuine changes, run git, pop the stash, and re-seal with the last full scan’s options. If a protected file holds edits of your own, they stop and change nothing until you stage and commit them or pass --discard-local-edits.
Files that differ per branch
If transform or config files differ per branch and keep getting in the way, exclude them once. Later scans remember it:
SecretSleuth --full-scan --exclude "**/Web.Debug.config" --exclude "**/Web.PROD.config"
When this ends
These commands are a bridge while placeholders exist. When the placeholders are replaced with safe values, committed, and the files unfrozen, plain git works everywhere again. See After remediation.