Skip to content

Instantly share code, notes, and snippets.

@kiwimato
Created November 27, 2021 15:25
Show Gist options
  • Save kiwimato/eadc7d3f6e47f9a69e3f5bf882939f1c to your computer and use it in GitHub Desktop.
Save kiwimato/eadc7d3f6e47f9a69e3f5bf882939f1c to your computer and use it in GitHub Desktop.
.xsession gpg-agent SSH_AGENT SSH_AUTH_SOCK Yubikey Jetbrains Pycharm IntelliJ IDEA
AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2)
if [[ ! -S $AGENT_SOCK ]]; then
gpg-agent --daemon --use-standard-socket &>/dev/null
fi
export GPG_TTY=$TTY
# Set SSH to use gpg-agent if it's enabled
GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf"
if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then
export SSH_AUTH_SOCK="$AGENT_SOCK.ssh"
unset SSH_AGENT_PID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment