如何修复 Windows 上的 git commit:“等待...关闭...文件:... vim.exe:C:/ Program:没有这样的文件或目录”

PRD*_*PRD 3 windows git vim

有谁知道如何修复这个错误?几天前在同一个存储库中一切正常。现在我正在尝试提交新的更改,但出现了无法修复的错误。据我所知,除了星期二补丁以来的一些 Windows 更新之外,没有任何变化。

$ git commit
hint: Waiting for your editor to close the file... C:/Program Files/Git/usr/bin/vim.exe: C:/Program: No such file or directory
error: There was a problem with the editor 'C:/Program Files/Git/usr/bin/vim.exe'.
Please supply the message using either -m or -F option.

$ git config --global core.editor
C:/Program Files/Git/usr/bin/vim.exe
Run Code Online (Sandbox Code Playgroud)

我已将 Windows 版 git 升级到最新版本,但这没有帮助。该错误没有任何意义;vim 运行良好。它说 git 正在等待 vim 关闭“C:/Program”,但这听起来像是 git 向 vim 传递了完整路径,但忘记转义空格。怎么会发生这种事?

phd*_*phd 5

您需要修复以下内容中的引号.gitconfig

git config --global core.editor "'C:/Program Files/Git/usr/bin/vim.exe'"
Run Code Online (Sandbox Code Playgroud)