OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.17134 N/A Build 17134
...
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~3696 Mhz
BIOS Version: American Megatrends Inc. 2.20, 10/27/2017
OS: Debian
Kernel: x86_64 Linux 4.4.0-17134-Microsoft
Shell: zsh 5.3.1
CPU: Intel Core i7-8700K CPU @ 3.696GHz
RAM: 8041MiB / 16344MiB
我在我的~/.gitconfig
中有这个:
[core]
editor = code --wait
当我运行git commit
时,vscode以C:\mnt\$PathToRepo$\.git\COMMIT_EDITMSG
开头,但是这个文件是空的(它应该提交更改为+ diff)。
当我写一个提交消息,保存并退出时,我在终端中得到这个:
Aborting commit due to empty commit message.
注意:
当我这样做:
git commit
;Aborting commit due to empty commit message.
之后,我再次运行git commit
;VSCode将使用我在步骤2中写入的相同提交消息打开(即:初始化repo)
如果重点是在vscode上使用WSL git,这里是官方解决方案:https://code.visualstudio.com/docs/remote/wsl。
基本上,你只需要安装Remote Development Extension Pack。
在尝试更多的事情时,这个解决方案有效:https://github.com/Microsoft/vscode/issues/27101#issuecomment-306994732
整个问题是翻译Windows文件的位置。使用诸如链接到那里的脚本(https://github.com/Milly/wslpath)和包装脚本将允许消息在vscode中正确打开。我亲自删除了包装器脚本中的-n选项,因为我更喜欢使用选项卡。