Created
May 23, 2014 00:08
-
-
Save bokutin/6b639ac6d355f6206e43 to your computer and use it in GitHub Desktop.
tmux SSH_AUTH_SOCK
This file contains 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
探したけどうまいものが見付からないので、メモ。。。 | |
@@ ~/.zprofile | |
if [ -z "$TMUX" -a -n "$SSH_AUTH_SOCK" ]; then | |
file=`echo $SSH_TTY | sed -e 's/\//_/g'` | |
abs="$HOME/.ssh/$file" | |
echo "export SSH_AUTH_SOCK=\"$SSH_AUTH_SOCK\"; export SSH_CONNECTION=\"$SSH_CONNECTION\"" > $abs | |
#echo "wrote $abs" | |
fi | |
@@ ~/.zshrc | |
function apply_ssh_auth_sock { | |
if [ -n "$TMUX" ]; then | |
file=`tmux display-message -p '#{client_tty}' | sed -e 's/\//_/g'` | |
abs="$HOME/.ssh/$file" | |
if [ -f $abs ]; then | |
source $abs | |
fi | |
fi | |
} | |
preexec() { | |
apply_ssh_auth_sock | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment