Git-seal provides seamless, transparent encryption for sensitive files in your Git repositories. Perfect for personal projects where you need to keep environment variables, API keys, and configuration files secure without complicated setup.
Git-seal is a lightweight Git filter that automatically encrypts specified files when committing to Git and decrypts them when checking out. It runs transparently in the background, so you work with plain text locally while Git stores encrypted versions.
- Zero Friction: No manual unlock/lock commands
- Git-Native: Works seamlessly with all Git commands
- Fast: Stream-based encryption/decryption
- Simple: 3 commands to complete setup
- Portable: Single binary, cross-platform
- Encryption: AES-256-CFB encryption
- Key Management: Single master key stored locally (
~/.git-seal.key) - Deterministic: Fixed IV ensures proper Git diff behavior
- Local Only: Your key never leaves your machine
- Go 1.16+ (for building from source)
- Git
# Clone or download the source code
# Save main.go from the repository
# Compile
go build -o git-seal main.go
# Install system-wide (optional)
sudo mv git-seal /usr/local/bin/git-seal keygenThis creates ~/.git-seal.key - BACK IT UP IMMEDIATELY!
git-seal setupecho "API_KEY=secret123" > .envCreate .gitattributes in your repository:
.env filter=git-seal diff=git-seal
git add .
git commit -m "Add environment configuration"Result:
- Local:
.envshowsAPI_KEY=secret123(readable) - Git: File is stored as encrypted binary (unreadable)
The ultimate convenience - no manual unlocking required:
# Delete local copy
rm -rf my-project
# Clone fresh
git clone <your-repo-url>
cd my-project
# File is automatically decrypted!
cat .env # Shows: API_KEY=secret123In .gitattributes:
.env filter=git-seal diff=git-seal
config/secrets.json filter=git-seal diff=git-seal
*.key filter=git-seal diff=git-seal
# Encrypt a file
cat sensitive.txt | git-seal clean > encrypted.bin
# Decrypt a file
cat encrypted.bin | git-seal smudge > sensitive.txt# See original content locally
cat .env
# See encrypted content in Git
git show HEAD:.envWhen the same API key is used across multiple projects, git-seal produces identical encrypted content:
# Project 1: API_KEY=secret123 β [ENCRYPTED BYTES: 1f87 30e6...]
# Project 2: API_KEY=secret123 β [ENCRYPTED BYTES: 1f87 30e6...]Result: Identical bytes reveal you're reusing secrets across projects!
Git-seal uses deterministic encryption (fixed IV derived from key) for Git compatibility:
- Same input β Same encrypted output
- Enables proper Git diffs and merges
- But sacrifices some security for convenience
# Attacker clones your multiple repos
git clone your-project-1 your-project-2
# Compares encrypted .env files
diff project1/.env project2/.env # IDENTICAL!
# β Attacker knows you reuse the same API key# β Bad: Same key everywhere
API_KEY=secret123
# β
Good: Unique names
PROJECT1_API_KEY=secret123
PROJECT2_API_KEY=secret123# Project 1
.env.prod filter=git-seal diff=git-seal
# Project 2
.env.staging filter=git-seal diff=git-seal# Instead of generic names
# API_KEY=secret123
# Use descriptive names
WEB_API_KEY=secret123
MOBILE_API_KEY=secret123
ADMIN_API_KEY=secret123| Use Case | Risk Level | Recommendation |
|---|---|---|
| Personal projects | π’ Low | Fine as-is, but use unique names |
| Team projects | π‘ Medium | Always use unique environment names |
| Enterprise environments | π΄ High | Consider HashiCorp Vault instead |
Git-seal prioritizes workflow convenience over perfect security. For maximum security, use unique environment variable names or consider enterprise key management solutions.
| Feature | Git-Seal | git-crypt |
|---|---|---|
| Setup Complexity | β Simple (3 commands) | βββ Complex (GPG setup) |
| Performance | βββ Fast (streaming) | ββ Moderate (file-based) |
| Workflow Friction | βββ Zero unlock needed | ββ Manual unlock/lock |
| Dependencies | β None (single binary) | β GPG required |
| Cross-Platform | βββ Perfect | ββ GPG compatibility issues |
| Git Integration | βββ Seamless | ββ Good |
- AES-256 encryption is cryptographically strong
- Local key storage - no server-side key exposure
- Deterministic encryption enables proper Git diffs
- Fixed IV: Less secure than random IV, but required for Git compatibility
- Local key: If someone accesses your machine, they can decrypt files
- No passphrase: Prioritizes convenience over additional security layer
- Backup your key to a secure location (password manager, encrypted storage)
- Use on personal projects only - not for team environments
- Keep the binary secure - anyone with the binary and key can decrypt
- Regular key rotation if security requirements demand it
Error: Key not found at ~/.git-seal.key. Run 'git-seal keygen' first.
Solution: Run git-seal keygen
Error: Failed to run git config
Solution: Ensure you have Git configured and proper permissions
- Check
.gitattributesis in repository root - Verify Git filter is configured:
git config --get-regexp filter - Ensure file pattern matches exactly
This is expected! Git diff shows encrypted content. Use git show to see the actual diff:
git show HEAD:.env | git-seal smudge | diff - .env1. git add .env
β Git calls: git-seal clean < .env > encrypted_version
β Stores encrypted_version in Git index
2. git checkout
β Git calls: git-seal smudge < encrypted_version > .env
β Creates readable .env file locally
Input Text β AES-256-CFB β Encrypted Binary β Git Storage
β β
Local File β AES-256-CFB β Decrypted Binary β Git Storage
my-app/
βββ .env # API_KEY=secret123 (readable locally)
βββ .gitattributes # .env filter=git-seal diff=git-seal
βββ .git-seal.key # Your master key (don't commit!)
βββ src/
βββ README.md
# 1. Build & Install
go build -o git-seal main.go
# 2. Setup (one-time)
git-seal keygen # Backup ~/.git-seal.key!
git-seal setup
# 3. Use
echo "API_KEY=secret" > .env
echo ".env filter=git-seal diff=git-seal" > .gitattributes
git add . && git commit -m "Secure config"That's it! Your files are now encrypted in Git, decrypted locally, with zero ongoing effort.
Built with β€οΈ for developers who value both security and simplicity.
Git-seal provides seamless, transparent encryption for sensitive files in your Git repositories. Perfect for personal projects where you need to keep environment variables, API keys, and configuration files secure without complicated setup.
Git-seal is a lightweight Git filter that automatically encrypts specified files when committing to Git and decrypts them when checking out. It runs transparently in the background, so you work with plain text locally while Git stores encrypted versions.
- Zero Friction: No manual unlock/lock commands
- Git-Native: Works seamlessly with all Git commands
- Fast: Stream-based encryption/decryption
- Simple: 3 commands to complete setup
- Portable: Single binary, cross-platform
- Encryption: AES-256-CFB encryption
- Key Management: Single master key stored locally (
~/.git-seal.key) - Deterministic: Fixed IV ensures proper Git diff behavior
- Local Only: Your key never leaves your machine
- Go 1.16+ (for building from source)
- Git
# Clone or download the source code
# Save main.go from the repository
# Compile
go build -o git-seal main.go
# Install system-wide (optional)
sudo mv git-seal /usr/local/bin/git-seal keygenThis creates ~/.git-seal.key - BACK IT UP IMMEDIATELY!
git-seal setupecho "API_KEY=secret123" > .envCreate .gitattributes in your repository:
.env filter=git-seal diff=git-seal
git add .
git commit -m "Add environment configuration"Result:
- Local:
.envshowsAPI_KEY=secret123(readable) - Git: File is stored as encrypted binary (unreadable)
The ultimate convenience - no manual unlocking required:
# Delete local copy
rm -rf my-project
# Clone fresh
git clone <your-repo-url>
cd my-project
# File is automatically decrypted!
cat .env # Shows: API_KEY=secret123In .gitattributes:
.env filter=git-seal diff=git-seal
config/secrets.json filter=git-seal diff=git-seal
*.key filter=git-seal diff=git-seal
# Encrypt a file
cat sensitive.txt | git-seal clean > encrypted.bin
# Decrypt a file
cat encrypted.bin | git-seal smudge > sensitive.txt# See original content locally
cat .env
# See encrypted content in Git
git show HEAD:.env| Feature | Git-Seal | git-crypt |
|---|---|---|
| Setup Complexity | β Simple (3 commands) | βββ Complex (GPG setup) |
| Performance | βββ Fast (streaming) | ββ Moderate (file-based) |
| Workflow Friction | βββ Zero unlock needed | ββ Manual unlock/lock |
| Dependencies | β None (single binary) | β GPG required |
| Cross-Platform | βββ Perfect | ββ GPG compatibility issues |
| Git Integration | βββ Seamless | ββ Good |
- AES-256 encryption is cryptographically strong
- Local key storage - no server-side key exposure
- Deterministic encryption enables proper Git diffs
- Fixed IV: Less secure than random IV, but required for Git compatibility
- Local key: If someone accesses your machine, they can decrypt files
- No passphrase: Prioritizes convenience over additional security layer
- Backup your key to a secure location (password manager, encrypted storage)
- Use on personal projects only - not for team environments
- Keep the binary secure - anyone with the binary and key can decrypt
- Regular key rotation if security requirements demand it
Error: Key not found at ~/.git-seal.key. Run 'git-seal keygen' first.
Solution: Run git-seal keygen
Error: Failed to run git config
Solution: Ensure you have Git configured and proper permissions
- Check
.gitattributesis in repository root - Verify Git filter is configured:
git config --get-regexp filter - Ensure file pattern matches exactly
This is expected! Git diff shows encrypted content. Use git show to see the actual diff:
git show HEAD:.env | git-seal smudge | diff - .env1. git add .env
β Git calls: git-seal clean < .env > encrypted_version
β Stores encrypted_version in Git index
2. git checkout
β Git calls: git-seal smudge < encrypted_version > .env
β Creates readable .env file locally
Input Text β AES-256-CFB β Encrypted Binary β Git Storage
β β
Local File β AES-256-CFB β Decrypted Binary β Git Storage
my-app/
βββ .env # API_KEY=secret123 (readable locally)
βββ .gitattributes # .env filter=git-seal diff=git-seal
βββ .git-seal.key # Your master key (don't commit!)
βββ src/
βββ README.md
# 1. Build & Install
go build -o git-seal main.go
# 2. Setup (one-time)
git-seal keygen # Backup ~/.git-seal.key!
git-seal setup
# 3. Use
echo "API_KEY=secret" > .env
echo ".env filter=git-seal diff=git-seal" > .gitattributes
git add . && git commit -m "Secure config"That's it! Your files are now encrypted in Git, decrypted locally, with zero ongoing effort.
Built with β€οΈ for developers who value both security and simplicity.