Skip to content

Instantly share code, notes, and snippets.

@johnmccabe
Created September 28, 2016 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmccabe/c4d63f48adc053bb196e9f9fe03dd907 to your computer and use it in GitHub Desktop.
Save johnmccabe/c4d63f48adc053bb196e9f9fe03dd907 to your computer and use it in GitHub Desktop.
Bash function to fix access to SSH agent when using TMUX and agent forwarding
# via https://coderwall.com/p/_s_xda/fix-ssh-agent-in-reattached-tmux-session-shells
fixssh() {
for key in SSH_AUTH_SOCK SSH_CONNECTION SSH_CLIENT; do
if (tmux show-environment | grep "^${key}" > /dev/null); then
value=`tmux show-environment | grep "^${key}" | sed -e "s/^[A-Z_]*=//"`
export ${key}="${value}"
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment