Vscode-gitlens: WSL repository fails to load: spawn: C:\WINDOWS\system32\git.exe ENOENT

Created on 20 Aug 2018  路  9Comments  路  Source: eamodio/vscode-gitlens


  • GitLens Version: 8.5.5
  • VSCode Version: 1.26.0
  • OS Version: Windows 10.0.17134 build 17134

Steps to Reproduce:

I cannot use GitLens, both Windows git and WSL git
FYI, my git repository is initialized from WSL (Windows Subsystem Linux, ubuntu 18).

Logs:

Error: spawn C:\WINDOWS\system32\git.exe ENOENT
GitExplorer[view=history].refresh reason='command'
Running(c:\Users\**censored**): git rev-parse --show-toplevel
Completed(c:\Users\**censored**): git rev-parse --show-toplevel Completed in 204 ms
getStatusForFile('/mnt/c/Users/**censored**', 'c:\Users\**censored**')
Running(/mnt/c/Users/**censored**): git -c color.status=false status --porcelain=v2 -- c:/Users/**censored**
FAILED(/mnt/c/Users/**censored**): git -c color.status=false status --porcelain=v2 -- c:/Users/**censored** FAILED in 0 ms
git -c color.status=false status --porcelain=v2 -- c:/Users/**censored**   cwd='/mnt/c/**censored**'
[2018-08-20 15:50:14:684] git rev-parse --show-toplevel Completed in 1096 ms (c:\Users\**censored**)
[2018-08-20 15:50:18:593] git rev-parse --show-toplevel Completed in 242 ms (c:\Users\**censored**)
[2018-08-20 15:50:18:596] git remote -v FAILED in 0 ms (/mnt/c/Users/**censored**)

Error: spawn C:\bin\wslgit.exe ENOENT
[2018-08-20 15:50:18:791] git rev-parse --show-toplevel FAILED in 190 ms (c:\Users\**censored**)

Error: Command failed: C:\bin\wslgit.exe -c core.quotepath=false -c color.ui=false rev-parse --show-toplevel
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[2018-08-20 15:50:18:798] git rev-parse --show-toplevel Completed in 200 ms (c:\Users\**censored**)
[2018-08-20 15:50:18:798] git rev-parse --show-toplevel Completed in 196 ms (c:\Users\**censored**)
[2018-08-20 15:50:18:800] git ls-files c:\Users\**censored** FAILED in 1 ms (/mnt/c/Users/**censored**)

Error: spawn C:\bin\wslgit.exe ENOENT
[2018-08-20 15:50:18:810] git -c color.status=false status --porcelain=v2 -- c:/Users/**censored** FAILED in 0 ms (/mnt/c/Users/**censored**)

Error: spawn C:\bin\wslgit.exe ENOENT
[2018-08-20 15:50:18:984] git ls-files c:\Users\**censored** FAILED in 191 ms ()

Error: Command failed: C:\bin\wslgit.exe -c core.quotepath=false -c color.ui=false ls-files c:\Users\**censored**
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[2018-08-20 15:51:00:301] git rev-parse --show-toplevel Completed in 224 ms (c:\Users\**censored**)
[2018-08-20 15:51:46:259] git rev-parse --show-toplevel Completed in 220 ms (c:\Users\**censored**)
help-wanted needs more info

Most helpful comment

Investigated, there are 2 problems:
1) WSLGit doesn't translate unix repository path to win path for rev-parse command (due to -c args) and GitLens is trying to cwd unix path. Filed https://github.com/andy-5/wslgit/pull/48 to fix it

2) WSLGit doesn't properly escape --format arg in log and stash commands due to spaces in the argument. This is not GitLens problem, but i filed #517 to help with it

After merging these 2 PRs, GitLens must work with wslgit normally.

All 9 comments

@rokoroku Do you have the same issue with GitLens 8.5.6?

Sure, same log in 8.5.6 below:

[2018-09-05 13:46:58:793] git rev-parse --show-toplevel Completed in 259 ms (c:\Users\rok\GitHub\path_to_repository)
[2018-09-05 13:47:04:248] git rev-parse --show-toplevel Completed in 168 ms (c:\Users\rok\GitHub\path_to_repository)
[2018-09-05 13:47:04:252] git remote -v FAILED in 1 ms (/mnt/c/Users/rok/GitHub/path_to_repository)

Error: spawn C:\Windows\System32\git.exe ENOENT
[2018-09-05 13:47:04:417] git rev-parse --show-toplevel FAILED in 162 ms (c:\Users\rok\AppData\Roaming\Code\User)

Error: Command failed: C:\Windows\System32\git.exe -c core.quotepath=false -c color.ui=false rev-parse --show-toplevel
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[2018-09-05 13:47:04:417] git rev-parse --show-toplevel FAILED in 158 ms (c:\Users\rok\AppData\Roaming\Code\User)

Error: Command failed: C:\Windows\System32\git.exe -c core.quotepath=false -c color.ui=false rev-parse --show-toplevel
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[2018-09-05 13:47:04:472] git rev-parse --show-toplevel Completed in 212 ms (c:\Users\rok\GitHub\path_to_repository)
[2018-09-05 13:47:04:473] git ls-files c:\Users\rok\GitHub\path_to_repository FAILED in 1 ms (/mnt/c/Users/rok/GitHub/path_to_repository)

Error: spawn C:\Windows\System32\git.exe ENOENT
[2018-09-05 13:47:04:623] git ls-files c:\Users\rok\AppData\Roaming\Code\User\settings.json FAILED in 204 ms ()

Error: Command failed: C:\Windows\System32\git.exe -c core.quotepath=false -c color.ui=false ls-files c:\Users\rok\AppData\Roaming\Code\User\settings.json
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[2018-09-05 13:47:07:159] git rev-parse --show-toplevel FAILED in 108 ms (c:\Users\rok\AppData\Roaming\Code\User)

Error: Command failed: C:\Windows\System32\git.exe -c core.quotepath=false -c color.ui=false rev-parse --show-toplevel
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[2018-09-05 13:47:09:115] git rev-parse --show-toplevel Completed in 117 ms (c:\Users\rok\GitHub\path_to_repository)
[2018-09-05 13:47:09:116] git ls-files c:\Users\rok\GitHub\path_to_repository FAILED in 1 ms (/mnt/c/Users/rok/GitHub/path_to_repository)

Error: spawn C:\Windows\System32\git.exe ENOENT
[2018-09-05 13:47:09:608] git rev-parse --show-toplevel Completed in 110 ms (c:\Users\rok\GitHub\path_to_repository)
[2018-09-05 13:47:09:812] git -c color.status=false status --porcelain=v2 -- c:/Users/rok/GitHub/path_to_repository/file FAILED in 0 ms (/mnt/c/Users/rok/GitHub/path_to_repository)

Error: spawn C:\Windows\System32\git.exe ENOENT
[2018-09-05 13:47:13:624] git -c color.status=false status --porcelain=v2 -- c:/Users/rok/GitHub/path_to_repository/file FAILED in 0 ms (/mnt/c/Users/rok/GitHub/path_to_repository)

Error: spawn C:\Windows\System32\git.exe ENOENT

@rokoroku Can you try setting the GIT_DISCOVERY_ACROSS_FILESYSTEM to 1 and see if it helps this issue?

Same here. Using wslgit and repo was initialized in WSL. GIT_DISCOVERY_ACROSS_FILESYSTEM didn't help

I don't currently have a WSL environment setup, so if anyone out there could help out to figure out what is wrong I would be very appreciative 馃槃

Investigated, there are 2 problems:
1) WSLGit doesn't translate unix repository path to win path for rev-parse command (due to -c args) and GitLens is trying to cwd unix path. Filed https://github.com/andy-5/wslgit/pull/48 to fix it

2) WSLGit doesn't properly escape --format arg in log and stash commands due to spaces in the argument. This is not GitLens problem, but i filed #517 to help with it

After merging these 2 PRs, GitLens must work with wslgit normally.

Got same error message with Cygwin git.
Strange, extension works on a different machine with much the same setup.
Trying to run commands in the integrated terminal produce expected output.

I have this issue with Cygwin as well, I am unsure of the exact cause of it is the issue.

[2019-11-08 11:15:04.296] [renderer1] [error] spawn C:\cygwin\bin\git.exe ENOENT: Error: spawn C:\cygwin\bin\git.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
xCykrix@samuel-laptop ~/projects/re-plex
$ ls C:/cygwin/bin/git.exe -al
-rwxr-xr-x 127 xCykrix None 2614291 Apr 22  2019 C:/cygwin/bin/git.exe

+1 for Cygwin integration. Default git integration tab in vscode works fine.
I've setup cygwin git.exe proxy (via compiled cyg-git) that forwards calls under cygwin git and getting error: spawn C:\tools\cyg-git\git.exe ENOENT

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ardeshir81 picture Ardeshir81  路  3Comments

batjko picture batjko  路  4Comments

mindpivot picture mindpivot  路  4Comments

carlleeswanson picture carlleeswanson  路  3Comments

rfgamaral picture rfgamaral  路  3Comments