尝试将 Git Bash 设置为终端的默认配置文件时,设置中出现 VSCode 错误

问题描述

我尝试将 Git Bash 设置为 VSCode 中的认终端,但无法成功。我试过关注下一篇文章

  1. How do I use Bash on Windows from the Visual Studio Code integrated terminal?
  2. How to Add Git Bash to VsCode

但他们还没有解决我的问题。

我设法在 settings.json生成配置文件,但由于某种我不知道的原因,Git Bash 无法运行,并且 VsCode 显示错误

我的settings.json

{
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell","icon": "terminal-powershell"
        },"Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe","${env:windir}\\System32\\cmd.exe"
            ],"args": [],"icon": "terminal-cmd"
        },"Git Bash": {
            "source": "Git Bash","path": "C:\\git-sdk-64\\git-bash.exe","args": [
                "--login","-i"
            ]
        },"Cygwin": {
            "path": "C:\\cygwin64\\bin\\bash.exe","args": [
                "--login"
            ]
        }
    },"terminal.integrated.defaultProfile.windows": "Git Bash"
}

错误

enter image description here

有人知道如何解决这个问题吗?

我的 VsCode 版本:

Version: 1.57.1 (user setup)
Commit: 507ce72a4466fbb27b715c3722558bb15afa9f48
Date: 2021-06-17T13:28:07.755Z
Electron: 12.0.7
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.19042

编辑:

我使用 git SDK,它类似于 git-bash 但不完全是。也许这就是问题所在?

解决方法

这终于对我有用

"terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell","icon": "terminal-powershell"
        },"Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe","${env:windir}\\System32\\cmd.exe"
            ],"args": [],"icon": "terminal-cmd"
        },"GitBash": {
            "path": ["C:\\Program Files\\Git\\bin\\bash.exe"],"icon": "terminal-bash"
        }
    },"terminal.integrated.defaultProfile.windows": "GitBash"
}