Bitwarden
Use Bitwarden secret references in .env files and resolve them securely at runtime with dotenvx.
1. Install
Get the Dotenvx CLI.
$ curl -sfS https://dotenvx.sh | sh
2. Add a secret reference
Reference a login item from your Bitwarden vault. Item names can contain spaces.
$ echo 'PASSWORD="bw://My GitHub Account/password"' > .env
The reference format is
bw://<item>/<field>. Use an item name or ID with the username, password, or uri field.
3. Run
Run your command with the secret resolved from Bitwarden. If the vault is locked, Bitwarden prompts you to unlock it.
$ dotenvx run -- sh -c 'echo Password loaded: ${PASSWORD:+yes}'
Password loaded: yes