GitHub for windows – git bash – remembering the passphrase

I seem to hit this issue every time I setup GitHub for Windows on a new machine.

I setup my SSH connection to the git server, but every single time I use git over the SSH transport, I need to re-enter my passphrase.

After finding and trying a few different solutions, this is what worked for me:

  1. Create a .bashrc file in your home directory (the %USERPROFILE% environement variable).
  2. Add the following lines in it:
    eval $(ssh-agent)

Start a git bash session – you will be asked for your passphrase once, at the start, and no more.

Using eval 'ssh-agent' did not work for me (and strictly speaking the #!/bin/bash is not needed).

Would love to hear about better alternatives / ways to achieve this.


Leave a Reply

Your email address will not be published.