Sublime Forum

Git for Windows fails with ST3 on Windows 11

#1

I have been using Sublime Text 3 as the editor on Git for Windows for years, on Windows 10. I recently purchased a Windows 11 machine. On that machine, when I give GFW the following command, I get the response shown:

$ git commit -a
[…]
hint: Waiting for your editor to close the file… C:\Program Files\Sublime Text 3\sublime_text.exe: C:Program: command not found
error: There was a problem with the editor ‘C:\Program Files\Sublime Text 3\sublime_text.exe’.
Please supply the message using either -m or -F option.

Does anyone know of a fix? To repeat, it’s only a problem on Windows 11.

0 Likes

#2

Is the git editor config set the same on both machines? (and is Sublime installed in the location that you think it is?)

0 Likes

#3

@OdatNurd The Git\etc\gitconfig file is identical on both machines (Windows 10 and Windows 11). In particular they both contain the following line:

editor = \"C:\\\\Program Files\\\\Sublime Text 3\\\\subl.exe\" -w

By the way, the actual line contains backslashes that this discussion board software appears to hide.

0 Likes

#4

My .gitconfig looks as follows. Working fine on Win11 / ST4160 / git version 2.42.0.windows.2

[core]
	editor = C:/Apps/Sublime\\ Text/subl.exe -w
0 Likes

#5

@deathaxe I tried putting your line into my .gitconfig file. It doesn’t fix the problem. This is a real mystery. Do you have any environment variables set that Git might rely on?

0 Likes

#6

Not that I am aware of, except adding having set the checkbox to run all unix tools from within normal dos shell.

The error message C:Program: command not found however indicates something to go wrong with interpreting quotes or escaped whitespace.

You could alternatively try to add ST’s install directory to %PATH and configure editor = subl.exe -w

Some other lines (for Sublime Merge) look as follows, but I guess, that was your original setting.

[core]
	editor = \"C:\\Apps\\Sublime Text\\subl.exe\" -w
0 Likes

#7

I edited the original post to put the setting in a code block; that stops it from interpreting the \ characters as quotes.

As a result, I’m not sure if the original setting had a set of \\\\ in it directly, or if that was an attempt to get the setting to visually display what it was originally set to.

0 Likes

#8

For my solution to the problem please see Stack Overflow.

0 Likes

#9

Type: Tip :bulb:

Check, if GIT_EDITOR environment variable exists.

In my case, the problem was that the value of this variable was set to the path to my old Sublime Text.

Thanks.

0 Likes