Why can't I set notepad++ as my git commit editor in Windows 10?

Viewed 3109

I know this question has been asked and answered more than once. But I tried at least ten different ways of doing it suggested by the answers and none of them work for me. I always get nano as the editor when I do

git commit

(This would not be such a big problem if I could cut and paste into nano, but it can't be done)

Just as an example, here are the lines in my .gitconfig file, but please bear in mind I tried many variations of this:

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

This should work:

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

or from command line:

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

PS: You could also install GitExtensions that will help you set it...

It isn't elegant but this worked for me (enclose double-quotes with single-quotes):

git config --global core.editor '"C:/Program Files/Notepad++/notepad++.exe"'

After unsuccessfully trying all the suggestions mentioned earlier, finally

git config --global core.editor "'C:\\Program Files\\Notepad++\\notepad++.exe'"

worked for me.

Related