Created
March 8, 2019 17:30
-
-
Save jathanism/345209c4083eefe00a3b4a5d6512908a to your computer and use it in GitHub Desktop.
My tmux setup that keeps sessions working perfectly. Every time a new session is started and `tmux` is ran, `_ssh_auth_save()` is called to refresh the symlink to `SSH_AUTH_SOCK`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Put me in ~/.tmux.conf | |
| set -g default-terminal "screen-256color" | |
| set -g update-environment -r | |
| setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Put me in ~/.zshrc.local | |
| # Link the latest ssh-agent socket | |
| _ssh_auth_save() { | |
| ln -sf $(find /tmp -maxdepth 2 -type s -name "agent*" -user $(whoami) -printf '%T@ %p\n' 2>/dev/null |sort -n|tail -1|cut -d' ' -f2) ~/.ssh/ssh_auth_sock | |
| } | |
| alias tmux='_ssh_auth_save ; tmux' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment