The SSH agent symlink tip will not fully work. If you connect with a second SSH session and then disconnect it will point to a stale SSH_AUTH_SOCK that doesn't work. The only way I found to solve this is by having a prompt command that refreshes it every time your prompt is rendered. So worst case is you have a broken ssh-agent for a single command.
Add this function to your zshrc/bashrc:
# This function refreshes some env vars that go stale in old tmux sessions
# It must be run as a preexec function in zsh or a PROMPT_COMMAND in bash
function refresh_env {
local ssh_auth_sock=""
if [[ -v "TMUX" ]]; then
ssh_auth_sock=$(tmux show-environment | grep "^SSH_AUTH_SOCK")
fi
if [[ -n "$ssh_auth_sock" ]]; then
#shellcheck disable=SC2163
export "$ssh_auth_sock"
fi
}
Then for bash, add this: if ! [[ "$PROMPT_COMMAND" =~ refresh_env ]]; then
PROMPT_COMMAND="refresh_env; $PROMPT_COMMAND";
fi
Or for zsh, add this: autoload -U add-zsh-hook
add-zsh-hook preexec refresh_env