Skip to content
Emil-02Public

About

Back up, restore, check and guard every .env file across all your repos: one age-encrypted vault, restore by git remote, pre-commit guard, TUI. Single Go binary, no server.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

6 Commits

Folders and files

Repository files navigation

envboy ๐Ÿค 

jaga

Back up, restore, check and guard every .env file across all your repos. One Go binary, no server, no account.

๐Ÿ‡ฎ๐Ÿ‡ฉ Baca dalam Bahasa Indonesia

Using an AI coding agent? Install jaga-skill with npx jaga-skill init โ€” a gate that stops the agent before commit/deploy when secrets or personal data are detected. It also guards .env files.

$ envboy backup ~/Proyek
โœ“ Backed up 23 files from 14 repos to ~/envboy.vault (passphrase)

# new laptop, repos cloned wherever you like
$ envboy restore ~/code
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Action   โ”‚ Repo                   โ”‚ File       โ”‚ Where / notes        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ + create โ”‚ github.com/me/campus   โ”‚ .env       โ”‚ ~/code/campus-hub    โ”‚
โ”‚ + create โ”‚ github.com/me/temuin   โ”‚ .env.local โ”‚ ~/code/temuin        โ”‚
โ”‚ ...                                                                    โ”‚

.env files are the one part of a project that git is supposed to forget. That is right for security, but it means that reinstalling or switching laptops leaves you copying dozens of files by hand from a USB stick, a chat with yourself, or an old restore-env.sh. A secret can also slip into a commit.

envboy handles all of it:

Command What it does
envboy scan Finds every env file under your folders and flags the ones that are committed or not in .gitignore
envboy backup Encrypts all of them into one age vault you can keep anywhere
envboy restore Puts each file back into the right repo, matched by git remote, so folder names and layout can change
envboy status Shows what changed since the last backup (key names only, never values)
envboy check Compares .env with .env.example: missing, extra and empty keys. CI-friendly exit codes
envboy guard Installs a pre-commit hook that blocks env files and fixes .gitignore
envboy Opens an interactive dashboard with all of the above

Install

go install github.com/Emil-02/envboy@latest

Or download a binary from Releases (Linux, macOS, Windows; amd64 and arm64).

Quick start

envboy scan ~/Proyek            # what is there, and is any of it leaking?
envboy backup ~/Proyek          # asks for a passphrase, writes ~/envboy.vault
# copy ~/envboy.vault to a USB stick, cloud drive, or a private repo

# on the new machine, after cloning your repos anywhere:
envboy restore ~/code --dry-run # see the plan
envboy restore ~/code           # write the files (asks to confirm)

Run envboy with no arguments for the dashboard:

 envboy ~/Proyek                                              ~/envboy.vault ๐Ÿ”“ 23 files
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎโ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Amboyy_Trade-AI            โœ“ 1 โ”‚โ”‚ kos-keluarga                                         โ”‚
โ”‚ Temuin                     โœ“ 1 โ”‚โ”‚ ~/Proyek/kos-keluarga                                โ”‚
โ”‚ kos-keluarga           !2 โ— 1  โ”‚โ”‚ github.com/emil-02/kos-keluarga                      โ”‚
โ”‚ umkm-kit                 โš  โœ“ 1 โ”‚โ”‚ โœ“ pre-commit guard installed                         โ”‚
โ”‚ Proyek_Fotografer         โ†“1 0 โ”‚โ”‚                                                      โ”‚
โ”‚                                โ”‚โ”‚ Env files                                            โ”‚
โ”‚                                โ”‚โ”‚  .env.local โ— changed since backup  9 keys           โ”‚
โ”‚                                โ”‚โ”‚    FONNTE_TOKEN, NEXT_PUBLIC_SUPABASE_URL, RESEND_โ€ฆ  โ”‚
โ”‚                                โ”‚โ”‚    only on disk: CRON_SECRET                         โ”‚
โ”‚                                โ”‚โ”‚                                                      โ”‚
โ”‚                                โ”‚โ”‚ Check against templates                              โ”‚
โ”‚                                โ”‚โ”‚  .env.local โ†” .env.example                           โ”‚
โ”‚                                โ”‚โ”‚    missing: MIDTRANS_SERVER_KEY, QRIS_MERCHANT_ID    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏโ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
 โ†‘โ†“ move  / filter  b backup  R restore  f fix .gitignore  h hook  u unlock  r rescan  ? help  q quit

Encryption: passphrase or age keys

Passphrase (default). You only need to remember one secret. envboy asks for it, or reads ENVBOY_PASSPHRASE in scripts. It uses age's scrypt mode.

age keys. No passphrase to type, and teammates can share a vault:

envboy keygen                   # writes ~/.config/envboy/key.txt and prints your public key
envboy backup ~/Proyek          # now encrypts to that key automatically
envboy backup -r age1teammateโ€ฆ -r age1youโ€ฆ  # or encrypt to several people
envboy restore -i ~/key.txt     # use a specific identity file

Back up key.txt itself, for example in a password manager. Without it, a key-encrypted vault cannot be opened. The vault is a standard age file, so age -d can decrypt it even without envboy.

How restore finds the right repo

Each backed-up file records the repo's normalized remote (git@github.com:Me/App.git and https://github.com/me/app both become github.com/me/app) plus its path relative to the scanned folder.

  1. If a local repo has the same remote, that repo is used, wherever it is.
  2. If several local clones share the remote, the one at the same relative path wins, then the one with the same folder name. If none of them fits, the file is reported as ambiguous and skipped.
  3. Repos without a remote, and plain folders, are matched by relative path. A different repository that now sits at the old path is never written into.

Local files that differ from the vault are never overwritten by default. --backup-existing moves them to .env.bak first, and --force overwrites them. Restored files get 0600 permissions.

Check against templates

$ envboy check ~/Proyek
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Repo         โ”‚ File                    โ”‚ Problems                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ kos-keluarga โ”‚ .env.local โ†” .env.example โ”‚ missing: MIDTRANS_SERVER_KEY   โ”‚
โ”‚              โ”‚                         โ”‚ empty: RESEND_API_KEY            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Each env file is compared with <name>.example (or .sample, .template, .dist) if there is one, otherwise with .env.example in the same folder. check exits with 1 when keys are missing, so you can use it in a predev script or in CI. --strict also fails on extra keys, empty values, and templates that have no env file.

Guard

envboy guard install            # this repo
envboy guard install --all ~/Proyek   # every repo below ~/Proyek
envboy guard fix ~/Proyek       # add ignore rules where env files are not ignored
envboy guard fix --untrack      # also `git rm --cached` env files that were committed

The hook respects core.hooksPath. An existing pre-commit hook is kept and runs after envboy's check, and guard uninstall puts it back. Templates such as .env.example stay committable.

What counts as an env file

.env, .env.* and *.env, except templates (*.example, *.sample, *.template, *.dist, *.tpl) and backups (*.bak, *.orig, *~). Folders such as node_modules, .venv, vendor, .next, dist and build are skipped. Files over 1 MiB are listed but not read. All of this can be changed in the config.

Configuration

Optional. Put it at ~/.config/envboy/config.yml:

roots: [~/Proyek, ~/Projects]   # scanned when you pass no directory
vault: ~/Dropbox/envboy.vault
recipients: [age1โ€ฆ]             # encrypt to these keys instead of a passphrase
skip_dirs: [archive]

See .envboy.example.yml for every option.

Scripting

Every command accepts --json. Exit codes:

Code Meaning
0 OK
1 Error, or check found missing keys, or guard run blocked a commit
2 scan found an env file committed to git
3 status: the vault and the disk differ

Security

  • Values are never printed. scan, status, check, the dashboard and --json show key names only.
  • The vault is a standard age file (ASCII-armored by default; --binary writes binary age). It is written atomically with 0600 permissions.
  • A key-encrypted vault never asks for a passphrase.

Read SECURITY.md for the threat model and how to report a vulnerability.

Development

make test     # unit + end-to-end tests (needs git)
make race
make lint     # golangci-lint
make fuzz     # fuzz the .env parser

License

MIT

About

Back up, restore, check and guard every .env file across all your repos: one age-encrypted vault, restore by git remote, pre-commit guard, TUI. Single Go binary, no server.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages