Skip to content

Instantly share code, notes, and snippets.

@laruiss
Created November 30, 2023 10:58
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 laruiss/4f73bdca50e16bcba39fc7d8fc6b43e3 to your computer and use it in GitHub Desktop.
Save laruiss/4f73bdca50e16bcba39fc7d8fc6b43e3 to your computer and use it in GitHub Desktop.
ZSH ssh-agent
# Check for a currently running instance of the agent
RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`"
echo "RUNNING_AGENT: $RUNNING_AGENT"
if [ "$RUNNING_AGENT" = "0" ]; then
# Launch a new instance of the agent
ssh-agent -s &> ~/.ssh/ssh-agent
fi
eval `cat ~/.ssh/ssh-agent`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment