Skip to content

Instantly share code, notes, and snippets.

@sdemjanenko
Created November 25, 2019 21:54
Show Gist options
  • Save sdemjanenko/4212cae4fe8f08b73a0823db8d8f86c3 to your computer and use it in GitHub Desktop.
Save sdemjanenko/4212cae4fe8f08b73a0823db8d8f86c3 to your computer and use it in GitHub Desktop.
WSL Ubuntu SSH agent socket
export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$HOSTNAME.sock
agent_count=`ps -C ssh-agent --no-headers | wc -l`;
if [ "$agent_count" = 0 ]; then
rm -f $SSH_AUTH_SOCK
fi
ssh-add -l 2>/dev/null >/dev/null
if [ $? -ge 2 ]; then
ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment