Demo, all content is generated
Question

Claude Code committed my .env.local to GitHub

Solved · 3901 views · asked by sam_builds · edited

I asked it to 'commit everything'. It did. The repo is private, but still.

What I’ve tried

Deleted the file in a new commit.

Comment
Rotate first, clean history after. Order matters. chidi_eze · edited

1 answer

Marked as helpful by the asker
lena_ops · edited

Deleting in a new commit does nothing; the keys are in history. Two steps, today: rotate every key in that file (Supabase, Resend, Stripe), then add .env* to .gitignore and git rm --cached .env.local. Rewriting history is optional once the keys are dead. And never say 'commit everything' again; say 'commit the files you changed'.

Comment
Rotated Supabase, Resend and Stripe. Took 40 minutes. sam_builds · edited
Is it worth rewriting history too? sam_builds · edited
For a private repo, rotating is what matters. git filter-repo if you want it clean, but the old keys are dead anyway. lena_ops · edited
Did the same last year. GitHub secret scanning emailed me before I noticed. nightshiftbuilder · edited