Skip to content

Instantly share code, notes, and snippets.

@reinaldorauch
Created February 28, 2020 15:11
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 reinaldorauch/770c2b56499190affb5cd8adc9f7bc5f to your computer and use it in GitHub Desktop.
Save reinaldorauch/770c2b56499190affb5cd8adc9f7bc5f to your computer and use it in GitHub Desktop.
Start ssh-agent when you open a bash shell, not written by me but don't remember where I found it
# ssh-agent
if [ -f ~/.ssh/agent.env ] ; then
. ~/.ssh/agent.env > /dev/null
if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then
echo "Stale agent file found. Spawning new agent… "
eval `ssh-agent | tee ~/.ssh/agent.env`
ssh-add
fi
else
echo "Starting ssh-agent"
eval `ssh-agent | tee ~/.ssh/agent.env`
ssh-add
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment