Setup
Install pass
Initialize pass
If you haven’t set up pass yet:Add Passwords
Template Functions
pass
Get the first line from a password entry:
pass show github/token and returns the first line.
passFields
Get structured data from a password entry with key-value pairs:
passRaw
Get the complete raw output from a password entry:
Usage Examples
Simple Passwords
Git Configuration
~/.gitconfig.tmpl
SSH Private Keys
Store SSH keys in pass:~/.ssh/id_rsa.tmpl
Structured Data with passFields
Store data as key-value pairs in pass:~/.aws/credentials.tmpl
Database Credentials
Multiple API Keys
~/.config/api-keys.env.tmpl
Docker Registry Credentials
~/.docker/config.json.tmpl
Kubernetes Config
~/.kube/config.tmpl
Configuration
Custom Command
Ifpass is not in your PATH:
~/.config/chezmoi/chezmoi.toml
Custom Password Store Location
By default, pass uses~/.password-store. To use a different location:
~/.bashrc
Organizing Your Password Store
Use a hierarchical structure:Advanced Usage
Using pass with Git
pass can sync with git:Team Password Sharing
Initialize pass for multiple GPG keys:Generating Passwords
Editing Passwords
Complete Examples
Multi-Service Configuration
~/.config/services.yml.tmpl
Troubleshooting
GPG Key Not Found
Ensure your GPG key is available:Password Not Found
List all passwords:Command Not Found
Ensure pass is installed:Testing Templates
Test template functions:GPG Agent Issues
If GPG prompts repeatedly for your password:Best Practices
- Use hierarchy: Organize passwords in logical folders
- Use descriptive names: Make entry names clear and searchable
- Backup regularly: Keep encrypted backups of your password store
- Use git: Sync your password store across machines with git
- Set GPG key expiry: Use expiring GPG keys for better security
- Use passFields: Structure complex data as key-value pairs
- Test access: Verify passwords are accessible before using in templates
See Also
- pass Website
- pass Git Repository
- Template Functions Reference
- gopass - Extended version of pass