'unable to set notepad++ as editor for git in PowerShell

I'm using Powershell ISE on a 64-bit Windows machine and when I type:

git config --list --show-origin I go down to the core.editor section and see:

core.editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin

as is suggested here: How can I set up an editor to work with Git on Windows?

However, when I type git commit hoping for the editor to open, I get the following error:

git : error: cannot spawn notepad++: No such file or directory
At line:1 char:1
+ git commit
+ ~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (error: cannot s...le or directory:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
error: unable to start editor 'notepad++'
Please supply the message using either -m or -F option.

So the error seems to be telling me I don't have notepad++ when I definitely do. Please help. I've been looking around for a while and have been unable to make any progress.



Solution 1:[1]

Depending on what git version you have, you should have in the .gitconfig an entry like this

[core]
    editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin

instead of something like

core.editor = 'C:/Pr....

but to be sure, you can run in the powershell directly the command:

git config --global core.editor "myEditor"

no matter which version of git you use, git will write it right in the config file...

in your case:

git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ΦXocę 웃 Пepeúpa ツ