Question

Replit agent deleted my .env when I asked it to clean up

Solved · 8 views · asked by amara_v · edited

Asked it to 'remove unused files'. It removed .env. Keys gone, app down for an hour until I found them in an old email.

What I’ve tried

Restored the keys. Want to make sure this cannot happen again.

Comment

1 answer

Marked as helpful by the asker
lena_ops · edited

Three layers:

  1. Secrets in Replit's Secrets panel, not in a file. The agent cannot delete what is not a file.
  2. .env in .gitignore AND a .env.example committed, so the shape survives.
  3. Never say 'clean up'. Say 'list files not imported anywhere, do not delete anything'. Deleting is your click.
Comment