From ae44913ddd2ab8b17594f0d471f37bd8c50e8a64 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Thu, 28 Apr 2022 13:47:07 +0300 Subject: bashrc: configure ssh agent --- .bashrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.bashrc b/.bashrc index 1397282..57f79fb 100644 --- a/.bashrc +++ b/.bashrc @@ -18,3 +18,13 @@ unset file # Add tab completion [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion + +# Use gpg-agent like SSH agent (https://wiki.archlinux.org/title/GnuPG#SSH_agent) +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +fi + +# Configure pinentry to use the correct TTY +export GPG_TTY=$(tty) +gpg-connect-agent updatestartuptty /bye >/dev/null -- cgit v1.2.3-18-g5258