Encrypted Secrets • Zero Plaintext • Instant Runtime Loading • 100% Commit Safe
better-env is a simple, secure CLI tool to manage environment variables centrally on your machine using PGP encryption. Keep your secrets out of repos and out of plaintext files, loading them into apps only at runtime. Never accidentally commit secrets again. .better-env files are fully commit-safe.
- Global encrypted store for all your secrets
- No plaintext .env files needed in projects
- Easy per-project selection of which keys to load
- Shell-friendly: start a subshell with secrets or run commands with injected secrets
- macOS/Linux:
curl -fsSL https://raw.githubusercontent.com/HarishChandran3304/better-env/main/scripts/install.sh | sh- Windows (PowerShell):
powershell -NoProfile -ExecutionPolicy Bypass -Command "iwr -useb https://raw.githubusercontent.com/HarishChandran3304/better-env/main/scripts/install.ps1 | iex"Note
The Windows installer uses PowerShell to install, but after installation bnv can be run from any shell on your PATH.
bnv setupbnv store KEYcd /path/to/my/project
bnv init
bnv add KEY
# Interactive shell (recommended)
bnv shell
# ... your commands here ...
exit
# One-off command
bnv run python3 main.pybetter-env officially supports Unix-like shells (macOS, Linux).
Warning
Windows support is experimental:
bnv runworks as expected.bnv shellattempts to launchpwsh, thenpowershell, thencmd.exefor an interactive session with secrets. Shell startup semantics differ from POSIX shells, so profile scripts > may not run the same.- For the best experience on Windows, consider WSL or Git Bash/MSYS2.
Contributions welcome. See CONTRIBUTING.md.
See the full documentation here
