From 3b27586cdf86c73a7424f5ca8bd52e19dc5a2159 Mon Sep 17 00:00:00 2001 From: Steve Beaulac Date: Tue, 28 Jul 2026 22:35:35 -0400 Subject: [PATCH] fix(fish): propagate SSH_AUTH_SOCK when tmux setenv is unavailable Some tools (herdr) don't use tmux's setenv -g to broadcast SSH_AUTH_SOCK to new panes. Refresh the symlink when a real socket is inherited, then always export the symlink path so child shells in new panes can find it. --- config/fish/conf.d/02-ssh-auth-sock.fish | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/fish/conf.d/02-ssh-auth-sock.fish b/config/fish/conf.d/02-ssh-auth-sock.fish index b6f6ce1..f019fa8 100644 --- a/config/fish/conf.d/02-ssh-auth-sock.fish +++ b/config/fish/conf.d/02-ssh-auth-sock.fish @@ -2,8 +2,19 @@ # tmux forces SSH_AUTH_SOCK to ~/.ssh/ssh_auth_sock globally # (see config/tmux/tmux.conf), so this symlink must exist for every # interactive shell -- not just bash login shells. +# +# For herdr (which lacks tmux's setenv -g): if we inherit a real +# SSH_AUTH_SOCK, update the symlink. Then always export the symlink +# path so new panes that didn't inherit the env still pick it up. set -l auth_sock "$HOME/.ssh/ssh_auth_sock" + +# If we have a real socket (not the symlink), refresh the symlink if set -q SSH_AUTH_SOCK; and test "$SSH_AUTH_SOCK" != "$auth_sock"; and test -S "$SSH_AUTH_SOCK" mkdir -p "$HOME/.ssh" ln -sf "$SSH_AUTH_SOCK" "$auth_sock" end + +# Always export the symlink path if it points to a live socket +if test -S "$auth_sock" + set -gx SSH_AUTH_SOCK "$auth_sock" +end