You need to make sure VSCode is opened with the same user account as the one used in your initial git bash.
In each session (bash and VSCode), execute a:
mkdir test
cd test
# Git bash
git -c core.sshCommand='ssh -Tv' clone git@github.com:...
# or, in POwershell
git -c core.sshCommand="ssh -Tv" clone git@github.com:...
See if the SSH key is looked into C:\Users\<You>\.ssh\id_rsa
Check also if you have created your private key encrypted with a passphrase.
If so, in VSCode, you would need to enable the SSH agent service.
Answer from VonC on Stack OverflowHow to "git clone " in Visual studio code - Stack Overflow
git - Clone GitHub repository in VSCode - Stack Overflow
Where is VS Code cloning a git repository? - Stack Overflow
[deleted by user]
Starting from the 1.8 (November) update of vscode you can now clone your Git repository from within the vscode.
You can execute it from the Command Palette. Press F1 (or ⇧+⌘+P on Mac) and search for Git: Clone. Confirm the command and paste the repository url.
There are now two programmatic ways how to clone a repository. VS Code handles the vscode:// protocol now, so you could clone a repository by clicking on a link somewhere on a web page
For example, clicking on the following link invokes VS Code, lets you select a folder on your disk, fetches the code and finally suggests to open that location as a workspace.
vscode://vscode.git/clone?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-extension-samples
Alternatively, if you are trying to trigger the cloning from an extension code, use the built-in VS Code command git.clone with the repo url as the only argument.
import { commands} from 'vscode';
commands.executeCommand("git.clone", "https://github.com/microsoft/vscode-extension-samples");
Both seem to do the same as the Git: Clone command mentioned by Jakub.
You can do explorer.exe . in your terminal to see the absolute path of the folder you are currently in. It should be something like C:\<some more stuff here>.
If you want to clone the repository elsewhere, then make sure Powershell is open in your Terminal, cd into the folder you want it to be in and git clone it there. As an example:
cd C:\Users\<your windows username>\Documents\;
git clone https://github.com/Azure-Samples/cognitive-services-speech-sdk.git;
If the first line doesn't work then that means you're in a linux terminal for which you can do:
cd /C/Users/<your windows username>/Documents;
git clone https://github.com/Azure-Samples/cognitive-services-speech-sdk.git;
When cloning a repository with the command palette, VS Code clones the repo in the path specified in the setting git.defaultCloneDirectory (/home/vscode/ might be proposed because set in this config variable). If git.defaultCloneDirectory is not set, VS Code clones the repository in the user's folder. On Windows, this corresponds to C:\Users\<Your-User>\.
If you want to specify a path for git.defaultCloneDirectory, just go to File > Preferences > Settings and then, either search for git.defaultCloneDirectory, or browse to Extension > Git > Default Clone Directory.
As a side note, if you clone a repository from VS Code bash without supplying a destination directory, the repo is always cloned in the user's folder, even if git.defaultCloneDirectory is set. git.defaultCloneDirectory is used only with the command palette.