Skip to content

Instantly share code, notes, and snippets.

@jmrnilsson
Created May 15, 2019 20:22
Show Gist options
  • Save jmrnilsson/43af68030a77ce82bba5d99cbda1a10c to your computer and use it in GitHub Desktop.
Save jmrnilsson/43af68030a77ce82bba5d99cbda1a10c to your computer and use it in GitHub Desktop.
ssh auth using git bash (mingw) on win 10

For file, open in notepad:

C:\Users\YOUR_USERNAME\.bash_profile

Add the lines:

#use fix path for SSH_AUTH_SOCK so it works more then one instance of gitbash
export SSH_AUTH_SOCK="$TEMP/ssh_agent_socket"

ps | grep ssh-agent > /dev/null
RUNNING=$?;

if [ "$RUNNING" -eq "1" ] 
then
# ssh-agent is not yet running
    eval `ssh-agent -a $SSH_AUTH_SOCK`
    ssh-add
else
# ssh-agent is already running
    ssh-add 
fi

Restart git bash. Partially sourced from https://github.com/sauter-hq/git-guidelines/wiki/Windows-gitbash-save-ssh-passphrase

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