Skip to content

Instantly share code, notes, and snippets.

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 derekschrock/9caecb49314eefc6dae69a1fa90eeb8c to your computer and use it in GitHub Desktop.
Save derekschrock/9caecb49314eefc6dae69a1fa90eeb8c to your computer and use it in GitHub Desktop.
if [[ -f "$SSH_AGENT_FILE" ]]; then
source "$SSH_AGENT_FILE" > /dev/null
ssh-add -l > /dev/null
if [[ "$?" -gt 1 ]]; then
if ssh-agent -t "${sshagent_time:-2d}" > "$SSH_AGENT_FILE"; then
source "$SSH_AGENT_FILE" > /dev/null
else
echo "Can't start ssh-agent or write ${SSH_AGENT_FILE}: $?"
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment