Get started
GitVault v2 is a fast, pure-CLI secrets manager powered exclusively by git and gh. Eliminate .env files in three commands: init, config, and load.
Install & prerequisites
Both git and the GitHub CLI (gh) must be installed and signed in. GitVault never stores or manages GitHub tokens on its own.
$ gh auth login $ curl -fsSL https://raw.githubusercontent.com/adhil72/gitvault/main/scripts/install.sh | sh
This installs gitvault and its short alias gv. Add the shell wrapper to your profile so gitvault load exports directly into your current terminal session in memory:
# bash or zsh (~/.bashrc / ~/.zshrc) eval "$(gitvault shell-init)" # fish (~/.config/fish/config.fish) gitvault shell-init fish | source
Initialize a project (`gitvault init`)
Run gitvault init inside any project folder. On your very first run, GitVault uses gh to create a private gitvault-store repository on your GitHub account, asks for a master password, and prints a one-time recovery key.
$ cd ~/projects/shop-api $ gitvault init # Interactive: pick or create project and default environment # Or non-interactive with flags: $ gitvault init -p shop-api -e development
This creates a minimal, non-secret gitvault.json safe to commit to Git — never a .env file:
{
"project": "shop-api",
"environment": "development"
}Your recovery key is printed once when the vault store is first created. Save it somewhere safe in case you ever forget your master password.
Configure variables & environments (`gitvault config`)
Run gitvault config inside your project (or pass -p <project>) for the interactive menu: choose Config variables, select or create an environment, and add, view, delete, copy, or import variables.
$ gitvault config # interactive wizard # Direct CLI shortcuts: $ gitvault config set DATABASE_URL=postgres://localhost/app $ gitvault config set API_KEY --value-stdin < key.txt $ gitvault config get DATABASE_URL $ gitvault config list # masked by default $ gitvault config list --reveal $ gitvault config rm API_KEY
Already have a .env file? Migrate it into your encrypted vault and remove the plaintext file in one command:
$ gitvault config import .env --delete-sourceManage environments directly as well:
$ gitvault config env list $ gitvault config env create preview $ gitvault config env clone development preview $ gitvault config env delete preview --yes
Load secrets into memory (`gitvault load`)
Secrets are decrypted in RAM and never written to disk as .env. Use gitvault.json automatically, or override with -p and -e:
# 1. Load into active shell session (with `eval "$(gitvault shell-init)"`): $ gitvault load $ gitvault load -p shop-api -e production $ gitvault unload # 2. Inject directly into a child process: $ gitvault load -- npm run dev $ gitvault load -p shop-api -e staging -- cargo run # 3. Export or JSON on stdout for scripts: $ eval "$(gitvault load -p shop-api -e production --export)" $ gitvault load -p shop-api -e production --json
Sync, backup & team sharing
Every change is automatically committed and pushed to your private gitvault-store repository on GitHub — so you never lose or forget a .env when switching laptops or formatting your machine.
Handing a project to another developer? Instead of pasting .env files in chat, add them as a collaborator/contributor to your private GitHub vault repository and share the vault password. Because gitvault.json is already in the project repo, they just run:
$ GITVAULT_REPO=<owner>/gitvault-store gitvault load -- npm run devUse sync, projects, and doctor to inspect state or pull changes manually:
$ gitvault sync $ gitvault sync --status $ gitvault projects $ gitvault doctor
Servers, CI & recovery
In CI or headless servers, authenticate gh (or provide GH_TOKEN) and set GITVAULT_PASSWORD (or pass --password-stdin). Pass --non-interactive so commands never hang waiting for input.
$ GITVAULT_PASSWORD=… gitvault --non-interactive \
load -p shop-api -e production -- ./deploy.sh