Git ssh clone: getting rid of the prompts for passphase

I wanted to write a script that ran in Windows command prompt and utilised Git Ssh.

This is simple to do with git-bash or here and I found quite a few instructions on Stackoverflow with solutions. Unfortunately, the problem with these approaches wass that if you are trying to write a windows command/powershell script rather that a bash script in Windows, this problem will need to be solved for Windows command prompt rather than for Git Bash.

  1. Download and install Git for Windows
  2. setx SSHAUTHSOCK H:.ssh.ssh-pageant-username
  3. "C:\Program Files\Git\cmd\start-ssh-agent.cmd"
  4. git clone ssh://[email protected]:22/VSTSProject/_ssh/Repository

I found this useful link with further information.

Other approaches include using Tortoise git or Putty to resolve the problem. However, I preferred resolving it without necessarily installing additional client side tools (apart from Git for Windows of course).