I have, until recently, been maintaining version control of various coding projects on a Windows machine via git installed within Cygwin. I am now in the process of switching over to Visual Studio Code as a text editor (I am still planning to compile via the command line, at least for now).
In order to keep double installations to a minimum, I have set VS Code's git.path variable to the git executable in the Cygwin directory. However, I am having an issue that VS Code does not seem to recognize my already-existing local git working directories, even when opening folders in VS Code at the root directory level (I have searched online and only come up with discussions from a year or two ago that suggested that this is necessary). When I click on the SOURCE CONTROL
tab, I see There are no active source control providers
.
Is there a way to not have to clone duplicate/replacement working directories through VS Code and to force it to use the already-cloned ones? I know I can continue to use Cygwin for git, and simply use VS Code as a text editor, but I was hoping to be able to use some of VS Code's helpful git features.
Simply use Git for Windows instead of Cygwin: you can unzip PortableGit-2.17.0-64-bit.7z.exe
anywhere you want.
Then VSCode will recognize your existing repositories without any issue.
Combine that with GitLens, and you can do most of your Git operations directly from the editor.
Note: if you really really had to use Cygwin, Microsoft/vscode issue 7998 reports (by Eric DraconPern) :
my solution was to install Git for Windows, and then use mklink to junction link the Cygwin
.ssh
directory to%USERNAME%/.ssh
to share config and ssh key.
Then both Git will have access to the same ssh key and ssh config for multiple key usage.
Also put theCygwin\bin
path first in %PATH% environment variable.
The same issue also mention nukata/cyg-git
This provides a Git for Windows virtually. You only need Cygwin and its packages.
I had once tried the Go plugin for VSCode on Windows 10 and found that it required Git for Windows implicitly. However, it was redundant since I had already installed Cygwin and its git package. So I wrote this proxy and wrapper.
Dmitry Katsubo proposes a bash version of that same script.
If you are on Windows 10, I would recommend WSL (Windows Subsystem for Linux), where you can install Git (the Linux original version).