Skip to content

Instantly share code, notes, and snippets.

@powellnathanj
Created September 23, 2018 13:43
Show Gist options
  • Save powellnathanj/d499ccd97cbbcefdad9dba1d2a4cca71 to your computer and use it in GitHub Desktop.
Save powellnathanj/d499ccd97cbbcefdad9dba1d2a4cca71 to your computer and use it in GitHub Desktop.
# ssh-agent configuration
if [ -z "$(pgrep ssh-agent)" ]; then
rm -rf /tmp/ssh-*
eval $(ssh-agent -s) > /dev/null
else
export SSH_AGENT_PID=$(pgrep ssh-agent)
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.*)
fi
if [ "$(ssh-add -l)" == "The agent has no identities." ]; then
ssh-add
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment