Skip to content

Instantly share code, notes, and snippets.

@JanTvrdik
Forked from gsomoza/.bashrc
Last active June 14, 2022 04:14
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save JanTvrdik/33df5554d981973fce02 to your computer and use it in GitHub Desktop.
Save JanTvrdik/33df5554d981973fce02 to your computer and use it in GitHub Desktop.
ssh-agent support for Git Bash / MinGW / msys / Windows
# put this in ~/.bashrc
export SSH_AUTH_SOCK=/tmp/.ssh-socket
ssh-add -l > /dev/null
if [ $? = 2 ]; then
rm -f $SSH_AUTH_SOCK
echo Starting new ssh-agent...
eval $(ssh-agent -a $SSH_AUTH_SOCK) > /dev/null
ssh-add && echo "ssh-agent set up successfully with the following keys:" && ssh-add -l
fi
@theWill
Copy link

theWill commented Nov 3, 2015

works in the .bash_profile also. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment