Skip to content

Getting Started

This guide gets you from zero to encrypted secrets in about 5 minutes. By the end, you’ll have:

  • dotsecenv installed
  • A vault configured with your GPG identity
  • Your first secret stored and retrieved

You need a GPG key. Most developers already have one for signing git commits. If not:

Terminal window
# Generate a new GPG key
gpg --full-generate-key
# Select: (1) RSA and RSA, 4096 bits, key does not expire
# Enter your name and email
  1. Install dotsecenv

    Terminal window
    brew tap dotsecenv/tap
    brew install dotsecenv

    Verify installation:

    Terminal window
    dotsecenv version
  2. Initialize configuration

    Create a config file:

    Terminal window
    dotsecenv init config

    This creates ~/.config/dotsecenv/config with default settings.

  3. Create a vault

    Terminal window
    dotsecenv init vault

    This creates an encrypted vault file at ~/.config/dotsecenv/vault.

  4. Login with your GPG key

    Find your GPG fingerprint:

    Terminal window
    gpg --list-secret-keys --keyid-format long

    Look for the fingerprint (40-character hex string) and login:

    Terminal window
    dotsecenv login YOUR_FINGERPRINT

    Or, if you have a single key, use this one-liner to auto-detect it:

    Terminal window
    dotsecenv login \
    $(gpg --list-keys --with-colons | awk -F: '/^fpr/ {print $10; exit}')
  5. Store your first secret

    Terminal window
    echo "my-secret-database-password" | dotsecenv secret put DATABASE_PASSWORD

    The secret is now encrypted in your vault.

  6. Retrieve the secret

    Terminal window
    dotsecenv secret get DATABASE_PASSWORD
    # Output: my-secret-database-password
  1. Config file (~/.config/dotsecenv/config) stores your settings and vault location
  2. Vault file (~/.config/dotsecenv/vault) is an encrypted JSONL file containing:
    • Your identity (GPG public key fingerprint)
    • Encrypted secrets
  3. Login associated your GPG key with dotsecenv so it knows which key to use for encryption/decryption

The real power comes from automatic secret loading. Install the shell plugin:

Terminal window
curl -fsSL https://raw.githubusercontent.com/dotsecenv/plugin/main/install.sh | bash

Then create a .secenv file in your project:

Terminal window
# .secenv - secrets loaded automatically when you cd into the directory
DATABASE_PASSWORD={dotsecenv}
API_KEY={dotsecenv/MY_API_KEY}

When you cd into the directory, dotsecenv prompts you to load the secrets.


Before moving on, verify:

  • dotsecenv version shows version info
  • dotsecenv vault list shows your vault with your identity
  • dotsecenv secret get DATABASE_PASSWORD returns your secret