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:
- Create a
.bashrc
file in your home directory (the%USERPROFILE%
environement variable). - 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.