Transparent Git encryption using age-encryption and git hooks. Encrypt sensitive files in your repository while keeping your workflow seamless.
- 🔐 Transparent Encryption - Automatically encrypt/decrypt files on commit and checkout
- 🔑 Age Encryption - Modern, fast encryption using the age standard
- 🪝 Git Hooks Integration - Hooks for
pre-commit,post-checkout,post-merge, andpre-push - 👥 Multiple Recipients - Manage encryption keys for different groups/users
- 🎯 Path-based Encryption - Specify which files to encrypt using glob patterns
- 💻 CLI Tools - Commands for managing recipients, encryption, and decryption
npm install -g git-encryptOr use with npx:
npx git-encrypt --helpcd your-repo
git-encrypt installThis creates a .gitencrypt/ directory and installs git hooks.
# Add your public key to the 'default' group
git-encrypt recipient add default YOUR_AGE_PUBLIC_KEY# Add a file or pattern to be encrypted
git-encrypt path add '*.env'
git-encrypt path add 'secrets/**'Files matching your encryption paths will be automatically:
- Encrypted before commit (via
pre-commithook) - Decrypted after checkout (via
post-checkouthook) - Decrypted after merge (via
post-mergehook)
git-encrypt install [dir] # Initialize encryption in a repository
--force # Overwrite existing hooks
--windows-fallback # Use wrapper scripts instead of symlinksgit-encrypt recipient add <group> <pubkey> # Add a recipient to a group
git-encrypt recipient remove <group> <pubkey> # Remove a recipient
git-encrypt recipient list # List all recipientsgit-encrypt path add <pattern> # Add a glob pattern to encrypt
git-encrypt path remove <pattern> # Stop encrypting a pattern
git-encrypt path list # List encrypted patternsgit-encrypt encrypt <file> # Manually encrypt a file
git-encrypt decrypt <file> # Manually decrypt a fileConfiguration is stored in .gitencrypt/:
.gitencrypt/recipients.json- Age public keys organized by group.gitencrypt/paths.json- Glob patterns for files to encrypt
- Node.js 22.0.0 or higher
MIT
Contributions are welcome! Please feel free to submit issues and pull requests.