Skip to content

Instantly share code, notes, and snippets.

@jasdeepkhalsa
Created October 16, 2014 13:18
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 jasdeepkhalsa/125ddfed2d66d722226a to your computer and use it in GitHub Desktop.
Save jasdeepkhalsa/125ddfed2d66d722226a to your computer and use it in GitHub Desktop.
SSH Reagent Function
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