Storing secrets in git encrypted on every commit with SOPS and age

The author keeps some secrets in a dotfiles repository on purpose, using a git filter that encrypts nine files with SOPS and age on commit and decrypts them on checkout. Git selects which files pass through the filter by path, and only the secret-looking values in .env files are encrypted, so diffs remain readable. The setup includes a clean script that reuses committed ciphertext when content is unchanged, avoiding false modifications caused by SOPS generating new IVs each time. The age private key is kept out of git and stored in a password manager, with a fix to point SOPS at the correct key path on fresh Macs. The author verifies the setup by confirming a clean git status and checking that the committed file contains encrypted values.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in