Created
November 29, 2017 17:06
-
-
Save teancom/d4b8cfd0ad9e693bfcb96e1b6172f9f3 to your computer and use it in GitHub Desktop.
SSH reagent for use within tmux, screen, etc.
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
ssh-reagent () { | |
for agent in /tmp/ssh-*/agent.*; do | |
export SSH_AUTH_SOCK=$agent | |
if ssh-add -l 2>&1 > /dev/null; then | |
echo Found working SSH Agent: | |
ssh-add -l | |
return | |
fi | |
done | |
echo Cannot find ssh agent - maybe you should reconnect and forward it? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment