Skip to content

chore: gitignore .env files#1322

Merged
thymikee merged 1 commit into
mainfrom
claude/gitignore-env
Jul 17, 2026
Merged

chore: gitignore .env files#1322
thymikee merged 1 commit into
mainfrom
claude/gitignore-env

Conversation

@thymikee

Copy link
Copy Markdown
Member

The repository is public and the root .env was untracked but matched no ignore rule. It showed up in git status, so any git add . or git add -A would have staged it — publishing whatever it holds to the repo and every fork.

$ git status --porcelain   # ?? .env
$ git check-ignore -v .env # no match

It has never been committed to any ref (git log --all --oneline -- .env is empty), so this is prevention rather than a leak. Nothing needs rotating.

What changed

.env.* subsumes the old examples/test-app/.env.local entry — the only dotenv rule in the file, covering exactly one path. Gitignore matches basenames at any depth, so every variant is now covered wherever it appears. !.env.example keeps templates trackable; none exist today, but that negation is what makes the broad .env.* safe.

Verified

Removing the examples/test-app/.env.local line is only safe if .env.* really does cover it, so I checked rather than assumed:

path result
.env, examples/test-app/.env ignored
.env.local, .env.production.local ignored
examples/test-app/.env.local (the removed rule) still ignored
website/.env.local ignored
.env.example trackable — negation works
src/utils/env-map.ts, src/platforms/linux/linux-env.ts unaffected

git ls-files | git check-ignore --stdin returns nothing, so no tracked file becomes ignored by this change.

Found while preparing #1321, and deliberately kept out of it — that PR staged explicit paths so .env was never at risk there.

The repository is public and the root `.env` was untracked but matched no
ignore rule, so it showed up in `git status` and any `git add .` or `git add -A`
would have staged it — publishing whatever it holds to the repo and every fork.

It has never been committed to any ref, so this is prevention rather than a
leak; nothing needs rotating.

`.env.*` subsumes the old `examples/test-app/.env.local` entry, which was the
only dotenv rule here and covered a single path. The rules match basenames at
any depth, so every variant is now covered wherever it appears. `!.env.example`
keeps templates trackable; none exist today, but the negation is what makes the
broad `.env.*` safe to add.
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.8 MB 1.8 MB 0 B
JS gzip 566.7 kB 566.7 kB 0 B
npm tarball 681.6 kB 681.6 kB 0 B
npm unpacked 2.4 MB 2.4 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.7 ms 27.8 ms -0.9 ms
CLI --help 59.6 ms 57.4 ms -2.2 ms

Top changed chunks: no changes in the largest emitted chunks.

@thymikee
thymikee merged commit b2b7ddd into main Jul 17, 2026
23 checks passed
@thymikee
thymikee deleted the claude/gitignore-env branch July 17, 2026 10:39
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-17 10:39 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant