Question

I have mysysgit and TortoiseGit installed on a Windows PC, which connects to a remote Git repo on a Linux box. I have created ssh keys, and added them to the profile in TortoiseGit. When I interact with the remote repo in TortoiseGit, it all works fine. No password prompting. However, when I try to run Git commands from the command line, I get prompted for the SSH password.

What do I need to do so that I'm not prompted for the password from the command line?

Was it helpful?

Solution

Make sure your git session references the TortoisePLink.exe (in GIT_SSH environment variable), as described in "Why git can't remember my passphrase under Windows":

(you might have done the first two steps already)

  • convert your key for use with TortoiseGit's pageant.exe using TortoiseGit's puttygen.exe.
  • Run TortoiseGit's pageant.exe, open your .ppk file ("Add Key"), and provide your passphrase for your key.
  • add the environment variable:

    GIT_SSH=C:\full\path\to\TortoisePlink.exe
    

This assumes your TortoiseGit is using TortoisePlink.exe.


The OP scott80109 concludes in the comments:

msysgit was installed to use Open SSH.
I changed it to use plink, and it now works without a prompt


Erez A. Korn adds in the comments:

I prefer to use openssh as it doesn't require me to have my key in an alternative format (ppk).
I've written a small wrapper to launch the ssh-agent and take care of business and then added it to my Windows Startup.
You can check the code in erezak/ssh-agent-wrapper-win.

OTHER TIPS

I recommend to use pageant. read this http://guides.beanstalkapp.com/version-control/git-on-windows.html and add you ssh-key to pageant. it affects globally.

My use case needed multiple github users with passphrase-protected ssh keys.

I sorted my ~.ssh/config file to use different keys for different repo domains, as described here

However, I don't want to type my passphrase every time, and I don't want to use ssh-agent.

Here's how I set up Pageant to ask for and remember my passphrase on Windows login:

  • Download the Putty Tools package
  • Win+R to open run dialog
  • shell:startup to open the auto start folder in windows explorer
  • Navigate to your Pageant folder in a separate Explorer window
  • Right click and drag PAGEANT.EXE to the Startup folder. Choose Create Shortcut
  • Right click the shortcut, properties, Shortcut tab
  • Find the path to your .ppk encoded keypair
    • generate one with PUTTYGEN.EXE if you need a new one
    • convert one with PUTTYGEN.EXE if you have a linux id_rsa file but no .ppk
    • win7+ : shift right click your key in Explorer, Copy as path
  • Append the key path to the C:\whatever\PAGEANT.EXE line
    • e.g: "Target: C:\putty\PAGEANT.EXE plato_cambrian.ppk plato.ppk"
    • If your keys aren't adjacent to PAGEANT you can use absolute paths or change "Start in:" which is Pageant's CWD
  • Open the shortcut or reboot, and type your passphrases

Also, for anyone on ubuntu/linux mint who ended up here, I documented similar steps here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top