Skip to content

Instantly share code, notes, and snippets.

@guiltry
Created March 23, 2017 08:26
Show Gist options
  • Save guiltry/4ad4b895a32488137e84a82ee7ab8ccd to your computer and use it in GitHub Desktop.
Save guiltry/4ad4b895a32488137e84a82ee7ab8ccd to your computer and use it in GitHub Desktop.
ssh-add -l &>/dev/null
if [ "$?" == 2 ]; then
test -r ~/.ssh-agent && \
eval "$(<~/.ssh-agent)" >/dev/null
ssh-add -l &>/dev/null
if [ "$?" == 2 ]; then
(umask 066; ssh-agent > ~/.ssh-agent)
eval "$(<~/.ssh-agent)" >/dev/null
ssh-add
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment