Created
September 28, 2016 19:55
-
-
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
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
# 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