Skip to content

Instantly share code, notes, and snippets.

@bokutin
Created May 23, 2014 00:08
Show Gist options
  • Save bokutin/6b639ac6d355f6206e43 to your computer and use it in GitHub Desktop.
Save bokutin/6b639ac6d355f6206e43 to your computer and use it in GitHub Desktop.
tmux SSH_AUTH_SOCK
探したけどうまいものが見付からないので、メモ。。。
@@ ~/.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