update .bashrc for GPG

This commit is contained in:
Cory Bennett
2016-12-21 17:46:22 -08:00
parent d5eed3a635
commit 9b53a617a7
+8 -5
View File
@@ -223,12 +223,15 @@ $ pass init "Go Jira <gojira@example.com>"
You probably want to setup gpg-agent so that you dont have to type in your gpg passphrase all the time. You can get `gpg-agent` to automatically start by adding something like this to your `$HOME/.bashrc`
```bash
if [ ! -f $HOME/.gpg-agent-info ]; then
# set passphrase cache so I only have to type my passphrase once a day
gpg-agent --default-cache-ttl 86400 --daemon --write-env-file $HOME/.gpg-agent-info
if [ -f $HOME/.gpg-agent-info ]; then
. $HOME/.gpg-agent-info
export GPG_AGENT_INFO
fi
# verify sock file from GPG_AGENT_INFO is actually present
if [ ! -S "${GPG_AGENT_INFO%%:*}" ]; then
# set passphrase cache so I only have to type my passphrase once a day
eval $(gpg-agent --default-cache-ttl 604800 --daemon --write-env-file $HOME/.gpg-agent-info)
fi
. $HOME/.gpg-agent-info
export GPG_AGENT_INFO
export GPG_TTY=$(tty)
```