--- /dev/null
+The 2.X branch of [[GnuPG]] comes with [gpg-agent][] for caching
+passphrases. The documentation is good, but here are my notes
+outlining my usual usage.
+
+Add
+
+ if [ -f "${HOME}/.gnupg/agent-info" ]; then
+ source "${HOME}/.gnupg/agent-info"
+ fi
+
+Start the agent with
+
+ $ GPG_TTY=$(tty)
+ $ gpg-agent --daemon --write-env-file "${HOME}/.gnupg/agent-info"
+ $ echo "GPG_TTY='${GPG_TTY}'; export GPG_TTY" >> "${HOME}/.gnupg/agent-info"
+ $ source "${HOME}/.gnupg/agent-info"
+
+The `GPG_TTY` bit will spawn the `pinentry` call in the designated
+TTY. This avoids troublesome issues like pinentry clobbering [[Mutt]]
+if they are both using ncurses.
+
+When you are done with the agent, kill it with
+
+ $ killall gpg-agent
+ $ rm -f "${HOME}/.gnupg/agent-info"
+
+[[!tag tags/linux]]
+[[!tag tags/tools]]
--- /dev/null
+#!/bin/bash
+# source me!
+
+FILE="${HOME}/.gnupg/agent-info"
+GPG_TTY=$(tty)
+#gpg-agent --daemon --enable-ssh-support --write-env-file "${FILE}" --pinentry-program "${HOME}/bin/pinentry"
+gpg-agent --daemon --write-env-file "${FILE}" --pinentry-program "${HOME}/bin/pinentry"
+echo "GPG_TTY='${GPG_TTY}'; export GPG_TTY" >> "${FILE}"
+source "${FILE}"