6

I've just started using Visual Studio Code (on Windows) for new UI project I've just joined. I have my Path environment variable configured to point to my cygwin git executable as follows:

C:\cygwin64\bin

I've verified that this is working by opening a Windows command prompt and successfully executing Linux commands. However, when I open the git project in Visual Studio Code, which looks to the path to resolve its "git.path" configuration, I get the following error:

ENOENT: no such file or directory, lstat 'C:\cygdrive'

Explicitly configuration the Workspace Settings file (settings.json) doesn't work either.

Any ideas?

jdogg
  • 61
  • 1
  • 2
  • See the fix to part of this question here: https://stackoverflow.com/a/69340165/61624 As for why you are getting that specific error, you'll need to show us what you set your git.path to. – Daniel Kaplan Sep 27 '21 at 01:22

4 Answers4

6

just create a symlink (windows): open a cmd prompt and use the following command:

mklink /j "C:\cygdrive" C:\actual\path\to\your\cygdrive

PS: For babun users, it would be your home directory:

mklink /j "c:\home" C:\Users\{user}\.babun\cygwin\home
Rigg802
  • 2,666
  • 1
  • 16
  • 14
  • This worked for me (babun), but path should user "Users", not "User". – Sergey Galchenko Sep 13 '16 at 08:35
  • After creating the link the error changes: `ENOENT: no such file or directory, lstat 'D:\cygdrive\c'` Note that my installation is in another drive. – Watchmaker Sep 25 '16 at 16:11
  • My Babun's `fstab` has the cygdrive at `/` instead of `/cygdrive` and my error message was about not finding `C:\c`. Doing `mklink /j "C:\c" C:\ ` seems to have fixed it. – Captain Man Dec 01 '16 at 20:02
  • 1
    So I have a standard install of cygwin and I am confused as to what `C:\actual\path\to\your\cygdrive` should actually be. I have cygwin installed at C:/cygwin64 – 2pha Mar 04 '17 at 02:19
  • 1
    it depends on how you installed Cygwin, but the default Windows path to your Cygwin home directory is usually C:\cygwin\home\%USERNAME% – Rigg802 Mar 06 '17 at 23:17
  • 1
    I ended up, creating a `C:/cygdrive/` folder, then in that folder, creating a symlink `C:/cygdrive/c/` that points to `C:/`. I hope it doesn't break anything else. – 2pha Mar 18 '17 at 02:10
  • Can someone please explain what `C:\actual\path\to\your\cygdrive` should be? What is a "cygdrive" and how do I know where mine is? Assuming that I installed Cygwin to the default location. – Andrew Koster Jun 02 '20 at 21:58
  • Why is this getting votes? This doesn't solve the problem, it just kicks the can to the next issue. You can't use the cygwin git.exe in visual studio code by setting `git.path`: https://github.com/microsoft/vscode/issues/7998 – Daniel Kaplan Sep 27 '21 at 01:20
0

generate bare git.exe wrapper Cygwin's git works for me under Win 7, https://github.com/nukata/cyg-git

Su Chale
  • 11
  • 1
-1

I can not commet. For babun users, the command should be

mklink /j "c:\cygdrive" C:\Users\{user}\.babun\cygwin\home

And after that, if you put your code in other path rather than under home, you should link the driver to home.For example, if your code path is D:\Codes\MyProject, you should run the command

mklink /j "C:\Users\{user}\.babun\cygwin\home\d" D:
曹维杰
  • 7
  • 1
-5

I had a similar problem. Here is what fixed the issue for me.

  • I had to include git.exe in the path. On my system it looks like this: "git.path": "D:\\Programs\\Git\\bin\\git.exe". VS Code seems to expect that the file is included in this path rather than just the folder location of the executable.
  • I had to restart VS Code for the git path setting change to take effect.

I hope this helps.

grahamaj
  • 1,334
  • 1
  • 10
  • 7