Skip to content

Instantly share code, notes, and snippets.

@omkensey
Last active September 29, 2025 14:19
Show Gist options
  • Select an option

  • Save omkensey/77558548eaf380ccbe661e45b0bf017f to your computer and use it in GitHub Desktop.

Select an option

Save omkensey/77558548eaf380ccbe661e45b0bf017f to your computer and use it in GitHub Desktop.
if [ -f ~/.ssh-agent ] && [ /dev/console -nt ~/.ssh-agent ]; then
rm -f ~/.ssh-agent
echo "Deleted old agent environment file."
fi
if [ ! -f ~/.ssh-agent ]; then
echo "Starting agent."
ssh-agent > ~/.ssh-agent
fi
source ~/.ssh-agent 2>&1 >/dev/null
if ! ssh-add -l > /dev/null 2>&1 ; then
ssh-add
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment