From 607fa9c573b9a7c791b5bc1c35aeade2109d3e35 Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 14 Jan 2022 22:46:21 -0300 Subject: [PATCH] bash: GPG SSH agent --- .bashrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.bashrc b/.bashrc index 307591c..27dec15 100644 --- a/.bashrc +++ b/.bashrc @@ -37,3 +37,13 @@ if ! "$REMOTE"; then PROMPT_COMMAND="osc7_cwd;$PROMPT_COMMAND" fi +# ------------------------------------------------------------------------------ +# GPG SSH agent +if ! "$REMOTE"; then + unset SSH_AGENT_PID + if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + # Start if not started + gpg-agent --daemon 2>/dev/null + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + fi +fi