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:
    #!/bin/bash
    eval $(ssh-agent)
    ssh-add
    

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.

1 Response

  1. Xplotz March 28, 2017 / 13:12

    Running putty’s Pageant should do all the magic without additional configuration. At least I can’t remember doing something else than starting my pageant

Leave a Reply

Your email address will not be published. Required fields are marked *