From 0deeea5b74890d551ea980fd2b29a804c89dafcb Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 14 Mar 2023 15:25:23 +0100 Subject: [PATCH] Use ssh-agent instead og gpg-agent for SSH --- zsh/.config/zsh/functions.zsh | 4 ++++ zsh/.config/zsh/gpg.zsh | 1 - zsh/.config/zsh/ssh.zsh | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 zsh/.config/zsh/ssh.zsh diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index b34010a..4082fc8 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -27,6 +27,10 @@ get_ip() { eval "curl ${ARGS[@]} -fsSL 'https://ifconfig.co/json$IP' $JQ" } +gpg_ssh() { + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +} + http() { (( ${+commands[python]} )) || return 2 [[ $# -gt 0 ]] && local DIR="--directory=$1" && shift diff --git a/zsh/.config/zsh/gpg.zsh b/zsh/.config/zsh/gpg.zsh index 912c435..5853ce9 100644 --- a/zsh/.config/zsh/gpg.zsh +++ b/zsh/.config/zsh/gpg.zsh @@ -1,6 +1,5 @@ if [[ -z $SSH_CONNECTION ]] && [[ $HOSTNAME != "toolbox" ]]; then export GPG_TTY="$TTY" - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" gpgconf --launch gpg-agent gpg-connect-agent updatestartuptty /bye &> /dev/null fi diff --git a/zsh/.config/zsh/ssh.zsh b/zsh/.config/zsh/ssh.zsh new file mode 100644 index 0000000..0f87d12 --- /dev/null +++ b/zsh/.config/zsh/ssh.zsh @@ -0,0 +1,2 @@ +[[ -z $SSH_CONNECTION ]] && [[ $HOSTNAME != "toolbox" ]] && + eval "$(ssh-agent)" &> /dev/null