GitSavvy: Cannot use WSL git.

  • Sublime Text version number: Build 3143
  • Git version number: 2.7.4
  • OS type and version: Windows 10 build 1709

The Windows Subsystem for Linux (WSL) ships with a copy of git. Unfortunately, GitSavvy does not seem to be able to use this version of git.

error: Your Git binary cannot be found.  If it is installed, add it to your PATH environment variable, or add a `git_path` setting in the `User/GitSavvy.sublime-settings` file.

The error seems to be twofold:

  1. GitSavvy does not try to use WSL git if it cannot find git for Windows.
  2. GitSavvy does not transform paths (replace drive letters with “/mnt/[letter]/”).

The first is fairly simple to workaround, just make a batch file that calls bash.exe -c 'git %*', the second is the real issue here. Worse, a simple script to transform paths doesn’t quite seem to be enough:

@echo off
setlocal enabledelayedexpansion

set find=Y:\
set replace=/mnt/y/
call set command=%%command:!find!=!replace!%%
set find=\
set replace=/
call set command=%%command:!find!=!replace!%%

::echo %command%

bash.exe -c 'git %command%'

This produces correct paths (for Y:\), but git reports:

fatal: Not a git repository (or any parent up to mount point /mnt/c)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I really, really do not want to install git for Windows. One install is bad enough.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

Projects settings:

{
    "settings":
    {
        "GitSavvy":
        {
        }
    }
}

You can tell GitSavvy which executable (the setting git_path) to use. It is crucial that you open and edit /mnt/c/.../somefile paths in Sublime Text. WSL paths must be supported in Sublime Text. (We can’t do all the path translations.) (The paths must be transparent. It can’t work otherwise.)