Created
February 28, 2020 15:11
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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