Windows linux子系统(WSL)上作为Git编辑器的VSCode 上下文 系统信息(Windows) 系统信息(WSL) 吉特

Windows linux子系统(WSL)上作为Git编辑器的VSCode 上下文 系统信息(Windows) 系统信息(WSL) 吉特,git,visual-studio-code,windows-subsystem-for-linux,commit-message,Git,Visual Studio Code,Windows Subsystem For Linux,Commit Message,我的~/.gitconfig中有这个: [core] editor = code --wait 问题: 当我运行git commit时,vscode以C:\mnt\$PathToRepo$\.git\commit\u EDITMSG开头,但是这个文件是空的(它应该有要提交的更改+一个diff) 当我写一条提交消息,保存并退出时,我会在终端中得到: Aborting commit due to empty commit message. 注意: 当我这样做时: 运行git提交 在vsc

我的
~/.gitconfig
中有这个:

[core]
    editor = code --wait
问题: 当我运行
git commit
时,vscode以
C:\mnt\$PathToRepo$\.git\commit\u EDITMSG
开头,但是这个文件是空的(它应该有要提交的更改+一个diff)

当我写一条提交消息,保存并退出时,我会在终端中得到:

Aborting commit due to empty commit message.
注意

当我这样做时:

  • 运行git提交

  • 在vscode中写入提交消息(例如初始化repo),保存并关闭

  • 由于提交消息为空而中止提交之后。
    ,我再次运行
    git commit


  • VSCode将以我在步骤2中编写的相同提交消息打开(即:初始化repo)

    尝试更多此解决方案有效:


    整个问题是为Windows转换文件的位置。使用一个脚本(比如链接到there()的脚本)和一个包装器脚本将允许消息在vscode中正确打开。我个人删除了包装器脚本中的-n选项,因为我更喜欢一个选项卡。

    如果重点是在vscode上使用WSL git,下面是官方解决方案:


    基本上,您只需要安装。

    我至少可以确认我看到了相同的东西。我从使用wslgit,但这似乎没有任何帮助。我想,这个问题可能是因为linux和windows上的tmp文件处理?我会在这里寻找答案:)
    [core]
        editor = code --wait
    
    Aborting commit due to empty commit message.