Have you spent the past several hours frantically searching the web for a solution of integrating Git with VSCode? Are you tempted to remove passphrases from your SSH Key just to get around Permission denied (
Yes, it is disappointing that there is no clear documentation for this.
Hopefully, this will fill the gap.
Created an SSH key using the Git terminal and is passphrase protected.
Added your SSH public key to your chosen Git Service.
Before starting VSCode, open up a new Windows CMD window.
Enter the command: start-ssh-agent and you will be prompted to provide the passphrase to your SSH Key.
Now you will be able to open VSCode and clone into your repository.
If you wanted to automate start-ssh-agent and open VSCode at the same time, I have built a batch script that will do just this.
Open text editor and paste in the code below. Save file as VSCode_ssh-agent.bat
I decided to place this file in my Windows home directory. On the Desktop, I created a shortcut to the .bat file and set the icon to point to:
C:\Users\[USER]\AppData\Local\Programs\Microsoft VS Code\Code.exe
The final result:
- Check if SSH-AGENT is running.
If not, start SSH-AGENT and ask for the passphrase for your key.
- Start VSCode