Skip to content

Commit 186f651

Browse files
committed
zsh: try tmux ssh again
These pretzels are making me thirsty
1 parent 4692d84 commit 186f651

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

zsh/plugins/tmux-ssh.zsh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Update SSH_AUTH_SOCK from tmux global environment when in tmux
2+
# This ensures SSH agent forwarding works after reattaching to old sessions
3+
_update_tmux_ssh_auth_sock() {
4+
if [ -n "$TMUX" ]; then
5+
eval $(tmux showenv -g SSH_AUTH_SOCK 2>/dev/null)
6+
fi
7+
}
8+
9+
# Run on every prompt to keep existing shells updated
10+
autoload -Uz add-zsh-hook
11+
add-zsh-hook precmd _update_tmux_ssh_auth_sock

0 commit comments

Comments
 (0)