Getting Started
This guide takes you from zero to an encrypted, auto-loading secret in about 5 minutes. By the end you will have dotsecenv installed, a vault with your identity, and a .secenv file that loads secrets automatically when you enter your project directory.
Prerequisites
Section titled “Prerequisites”You need a GPG key. Most developers already have one for signing git commits. If not:
# Generate a new GPG key with dotsecenv (after install below)dotsecenv identity create# Enter your name and email when promptedThis uses FIPS-compliant defaults (P-384 curve, 2-year expiration). See identity create for algorithm options.
gpg --full-generate-key# Select: (1) RSA and RSA, 4096 bits, key does not expire# Enter your name and email-
Install dotsecenv
Terminal window curl -fsSL https://get.dotsecenv.com/install.sh | bashThe installer downloads the binary, verifies signatures, and installs the shell plugin, completions, and man pages. See the installation reference for all options.
Terminal window brew tap dotsecenv/tapbrew install dotsecenvTerminal window curl -fsSL https://get.dotsecenv.com/key.asc | \sudo gpg --dearmor -o /etc/apt/keyrings/dotsecenv.gpgecho "deb [signed-by=/etc/apt/keyrings/dotsecenv.gpg] \https://get.dotsecenv.com/apt/ ./" | \sudo tee /etc/apt/sources.list.d/dotsecenv.listsudo apt-get update && sudo apt-get install dotsecenvVerify installation:
Terminal window dotsecenv version -
Activate the shell plugin
Add the source line the installer printed to your shell configuration:
Terminal window echo 'source ~/.local/share/dotsecenv/plugin/dotsecenv.plugin.zsh' >> ~/.zshrcTerminal window echo 'source ~/.local/share/dotsecenv/plugin/dotsecenv.plugin.bash' >> ~/.bashrcThe installer links the plugin automatically for Fish. If it did not, run:
Terminal window ln -sf ~/.local/share/dotsecenv/plugin/conf.d/dotsecenv.fish ~/.config/fish/conf.d/dotsecenv.fishReload your shell:
Terminal window exec $SHELL -
Initialize and login
Terminal window dotsecenv init configdotsecenv init vaultdotsecenv login # select your GPG key interactively -
Store a secret
Terminal window echo "s3cr3t-db-pass" | dotsecenv secret store DATABASE_PASSWORD -
Create a
.secenvfileTerminal window mkdir -p ~/my-projectecho 'DATABASE_PASSWORD={dotsecenv}' > ~/my-project/.secenvThis tells the shell plugin to fetch
DATABASE_PASSWORDfrom your vault whenever you enter the directory. -
Watch it auto-load
Terminal window cd ~/my-project# dotsecenv: found .secenv in /home/you/my-project# Load secrets? [y]es / [n]o / [a]lways: a# dotsecenv: loaded 1 secret(s) from .secenv: DATABASE_PASSWORDecho $DATABASE_PASSWORD# Output: s3cr3t-db-passcd ~# dotsecenv: unloaded 1 secret(s): DATABASE_PASSWORDecho $DATABASE_PASSWORD# Output: (empty)
What just happened
Section titled “What just happened”- Your secret is encrypted at rest in the vault using your GPG key (AES-256-GCM)
- The shell plugin auto-loads secrets when you
cdinto a directory with a.secenvfile - Secrets are auto-unloaded when you leave the directory tree
- The vault file is safe to commit to git — it’s just encrypted JSONL
Verification checklist
Section titled “Verification checklist”Before moving on, verify:
dotsecenv versionshows version infodotsecenv vault describeshows your vault with your identitydotsecenv secret get DATABASE_PASSWORDreturns your secret
What’s next
Section titled “What’s next”- Reloading Secrets — What to do when vault updates don’t appear in your shell
- Migrate from .env — Move existing secrets from plaintext
.envfiles - Share a Secret — Share encrypted secrets with teammates
- Shell Plugins — Trust system,
dse up, nested.secenvfiles - Security Model — Understand how encryption works
- CLI Reference — Full command documentation