Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devbox): stop syncing .env to the devbox (#126336)

Georges-Antoine Assidc26f7a94e85
diff --git a/.agents/skills/setting-up-devbox/references/sync.md b/.agents/skills/setting-up-devbox/references/sync.md
index be70134a8666..42dcdd00580a 100644
--- a/.agents/skills/setting-up-devbox/references/sync.md
+++ b/.agents/skills/setting-up-devbox/references/sync.md
@@ -23,7 +23,8 @@ hogli devbox:sync --terminate # remove the mirror when done
- **A stopped box's mirror waits paused.** `devbox:stop` pauses the mirror, and `devbox:start` resumes it once the box is up. A plain `devbox:sync` leaves a paused mirror paused, so resume one that a box started elsewhere with `--resume`.
- **The mirror never starts a box.** Its SSH connections run with Coder's autostart off, so a mirror to a box Coder stopped fails until the box runs again.
- **Don't edit mirrored files on the box.** Remote edits fight the local source of truth. `devbox:open --vscode` and `--cursor` warn when a sync is active.
-- **Check before recreating.** Compare the box's branch and SHA and the sync state first. If they match and no source file conflicts, keep the existing mirror. Source-file conflicts block reliable QA until resolved. A conflict in box-local config such as `.env` is acceptable when tracked source is clean.
+- **Check before recreating.** Compare the box's branch and SHA and the sync state first. If they match and no source file conflicts, keep the existing mirror. Source-file conflicts block reliable QA until resolved. A conflict in box-local config is acceptable when tracked source is clean.
+- **`.env` and `.env.local` don't sync.** The box writes its own `.env` at startup, and a worktree copies the main checkout's `.env`, so each side keeps its own. Change the box's copy on the box.
## Ignore rules
diff --git a/tools/hogli-commands/hogli_commands/devbox/mutagen_defaults.yml b/tools/hogli-commands/hogli_commands/devbox/mutagen_defaults.yml
index a36a2b3b12e4..67d3fe0f9705 100644
--- a/tools/hogli-commands/hogli_commands/devbox/mutagen_defaults.yml
+++ b/tools/hogli-commands/hogli_commands/devbox/mutagen_defaults.yml
@@ -56,6 +56,7 @@ sync:
- '.dagster_home'
- 'mprocs.log'
- 'bin/start.lock'
+ - '.env'
- '.env.local'
# Editor / OS.