I've setup a Windows 10 machine with VSCode and needed to clone a repo so I installed the tooling (Git, NuGet, posh-git and the Environment Variable) using Powershell:
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install git -y
#devlog('Install NuGet, Git, SSH Keys directory and set region')
$newPath = "$($env:PATH)C:\Program Files\Git\bin;"
[Environment]::SetEnvironmentVariable( 'PATH', $newPath, "Machine")
$env:PATH = $newPath
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
install-module posh-git -force
Now in VSCode when I try a Git Clone I get an error:
Command 'git.clone' not found
I have git installed as per the Powershell code. I have typed git clone
with the space not the dot and same problem.
Also I should note this code worked perfectly about a month ago, so what could the problem be?
It looks like the Git install has changed slightly. In the above code I set the Environment variable for the Git\Bin folder:
Directory of C:\Program Files\Git\bin
10/16/2019 10:34 PM <DIR> .
10/16/2019 10:34 PM <DIR> ..
08/17/2019 09:27 AM 43,616 bash.exe
08/17/2019 09:27 AM 43,096 git.exe
08/17/2019 09:27 AM 43,616 sh.exe
That's not where VSCode likes to find the exe. Adding a Environment Variable to C:\Program Files\Git\cmd and not C:\Program Files\Git\bin resolves the problem:
Directory of C:\Program Files\Git\cmd
10/16/2019 10:34 PM <DIR> .
10/16/2019 10:34 PM <DIR> ..
08/17/2019 09:27 AM 151,136 git-gui.exe
08/17/2019 09:27 AM 43,096 git-lfs.exe
08/17/2019 09:27 AM 43,096 git.exe
08/17/2019 09:27 AM 151,128 gitk.exe
08/17/2019 09:27 AM 3,022 start-ssh-agent.cmd
08/17/2019 09:27 AM 2,723 start-ssh-pageant.cmd