Skip to content

Commit ac4fa2a

Browse files
committed
Use gpg's ssh auth sock
If the SSH auth sock from gpg is available, then use it.
1 parent 3367898 commit ac4fa2a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.bashrc

+6-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ fi
127127

128128
# setup ssh-agent
129129
# only setup ssh agent if not previosly set
130-
if ! [ -v SSH_AUTH_SOCK ]; then
130+
if [ -v SSH_AUTH_SOCK ]; then
131+
if [ -S "$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh" ]; then
132+
SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh
133+
export SSH_AUTH_SOCK
134+
fi
135+
else
131136
SSH_DIR=$XDG_RUNTIME_DIR/gnupg
132137
if ! [ -d "$SSH_DIR" ]; then
133138
mkdir -p "$SSH_DIR"

0 commit comments

Comments
 (0)