1 parent 4692d84 commit 186f651Copy full SHA for 186f651
1 file changed
zsh/plugins/tmux-ssh.zsh
@@ -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