Commit your .env.
The only reason you can't is that Git has one history and one set of readers. newgit gives every file an owner with its own audience, so secrets live in the repo, and every branch comes up with everything it needs to run.
curl -fsSL https://newgit.dev/install.sh | sh
brew tap spheroman/newgit brew install newgit
Then tell your agent:
Set up newgit in this project.
Time to set up a new worktree for T3 Code
Worktree times from Theo Browne's benchmark: pnpm install in a new T3 Code worktree, median per machine, on a $12,000 Mac and a $700 PC. newgit spawn is the median of 9 runs on an M5 Pro, after the first install.
.env over by handpnpm install againTrackers
A tracker owns a set of paths and has its own history and audience. Your code is one, your .env is another. Together they make one ordinary Git repo, and every commit splits back to the tracker that owns it.
Your agent still sees Git
No new commands to learn. git commit, git push, and gh pr create work the way the agent expects.