无法在PowerShell中将notepad++设置为git的编辑器



我在64位Windows机器上使用Powershell ISE,当我键入:时

git config --list --show-origin我转到core.editor部分,然后查看:

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

正如这里所建议的:我如何设置一个编辑器来在Windows上使用Git?

然而,当我键入git commit希望编辑器打开时,我会得到以下错误:

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.

所以这个错误似乎告诉我我没有记事本++,而我确实有。请帮忙。我四处寻找了一段时间,一直没有取得任何进展。

根据您的git版本,您应该在.gitconfig中有一个类似的条目

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

而不是像这样的东西

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

但可以肯定的是,您可以直接在powershell中运行命令:

git config --global core.editor "myEditor"

无论您使用哪种版本的git,git都会将其直接写入配置文件。。。

在您的情况下:

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

最新更新