【问题标题】:How do I use Bash on Windows from the Visual Studio Code integrated terminal?如何从 Visual Studio Code 集成终端在 Windows 上使用 Bash?
【发布时间】:2017-07-25 05:07:57
【问题描述】:

Windows 上的 Visual Studio Code 默认使用 PowerShell 作为集成终端。如果你想在 Visual Studio Code 中使用 Bash,应该遵循哪些步骤?

【问题讨论】:

标签: visual-studio-code git-bash vscode-settings


【解决方案1】:

VSCODE 1.63.2

即使结合这里的答案,我也无法让它发挥作用。也许,我有一个有点异国情调的设置。我会收到此错误,设置 "terminal.integrated.defaultProfile.windows": "Git Bash" 并且它仍然只会打开 Powershell 并且无处可见 Git Bash:

我的解决方法是通过更改指向 bash 的路径来修改 Command Prompt 的条目,然后将其设置为默认值,如下所示:

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

【讨论】:

    【解决方案2】:

    只需转到 Visual Studio 代码中的 settings.json 并添加以下行:

      "terminal.integrated.defaultProfile.windows": "Git Bash",
    

    【讨论】:

      【解决方案3】:

      Visual Studio Code 可以在配置Terminal: Select Default Profile 的菜单中检测并列出已安装的Git Bash,正如许多其他答案已经描述的那样,但这从未发生在我身上。对于那些像我一样不那么幸运的人,您可以手动将自定义配置文件添加到 Visual Studio Code 的settings.json

      {
          // Tested in Visual Studio Code version 1.58.2, 1.59.1
          // Notice: my git install path is `D:\Git\bin\bash.exe`
      
          //"terminal.integrated.shell.windows": "D:\\Git\\bin\\bash.exe",
          // This works fine for me for a long time,
          // but in latest versions this is reported as deprecated,
          // you can keep this and sometimes Visual Studio Code will prompt to help
          // `migrate` it into new setting.
      
          // This part can be generated by Visual Studio Code
          "terminal.integrated.profiles.windows": {
              // This seems to be a reserved profile name, and also does not work for
              // me
              "Git Bash": {
                  "path": "D:\\Git\\bin\\bash.exe",
                  "icon": "terminal-bash"
              },
              "PowerShell": {
                  "source": "PowerShell",
                  "icon": "terminal-powershell"
              },
              "Command Prompt": {
                  "path": [
                      "${env:windir}\\Sysnative\\cmd.exe",
                      "${env:windir}\\System32\\cmd.exe"
                  ],
                  "args": [],
                  "icon": "terminal-cmd"
              },
      
              // Add your custom one with a different profile name from "Git Bash"
              "gitbash": {
                  "path": "D:\\Git\\bin\\bash.exe",
                  "icon": "terminal-bash"
              }
          },
          // Set the custom profile as default
          "terminal.integrated.defaultProfile.windows": "gitbash",
      
          // ...
      }
      
      

      【讨论】:

      • 对于"terminal.integrated.defaultProfile.windows": "gitbash"- 不接受值。有效值:“PowerShell”、“命令提示符”、“Git Bash”、“JavaScript 调试终端”。
      • @Raul 只是一个警告,你可以尝试重新加载 VS Code 窗口查看效果。如果您为"terminal.integrated.defaultProfile.windows" 设置的配置文件名称对应于在"terminal.integrated.profiles.windows" 添加的配置文件名称,它应该可以工作。
      • 我的有以下行,它适用于我的系统:"terminal.integrated.defaultProfile.windows": "Git Bash"
      • @SherylHohman 是的,如果“Git Bash”配置文件已经存在并且工作正常,但如果不存在,您也可以添加自定义配置文件作为我的回答所介绍的内容。
      • 要点是您提供的名称必须与现有(自定义)配置文件名称相匹配。它可以任意命名,但两个位置的名称必须相同……这可能是@Raul 错误的来源。相应地编辑 settings.json 文件。
      【解决方案4】:

      VS 代码 1.60.0

      当我遇到前面的问题时,Git Bash 根本没有被识别,尽管之前已经安装了。要让上述任何解决方案发挥作用,您需要按照thread 中讨论的说明以及下面列出的说明进行操作。

      1. 转到您的settings.json
      2. 启用 git bash 添加"git.enabled": true
      3. 并通过添加"git.path": "<YOUR PATH TO GIT>\\Git\\bin\\bash.exe" 定义路径

      之后,例如@rustyhu 定义的指令将起作用。

      PS:希望我能在调试最初陈述的问题时为您节省几个小时的时间

      【讨论】:

      • 不是<YOUR PATH TO GIT>\\Git\\bin\\git.exe 而不是bash.exe 吗?它用于"git.path",git 可执行文件的路径和文件名。
      • "git.enabled": true,救了我的命!
      【解决方案5】:

      将此添加到 settings.json

      {
          "terminal.integrated.profiles.windows": {
              "PowerShell": {
                  "source": "Git Bash",
                  "icon": "terminal-bash"
              },
      

      【讨论】:

        【解决方案6】:
        1. https://git-scm.com/download/win 安装 Git

        2. 打开 Visual Studio Code 并按住 Ctrl + ` 打开终端。

        3. 使用 Ctrl + Shift + P 打开命令面板。

        4. 类型 - 选择默认配置文件

        5. 从选项中选择 Git Bash

        6. 点击终端窗口中的+图标

        7. 现在的新终端将是一个 Git Bash 终端。给它几秒钟的时间来加载 Git Bash

        8. 您现在也可以从终端的下拉菜单中切换不同的终端。

        【讨论】:

        • 这对我有用。我通过手动添加默认 bash 尝试了所有其他指南,但它每次都打开一个新的终端窗口。非常感谢
        • 这就是我正在寻找的......这应该是更简单的接受答案
        • 完美解释..感谢您的回复。
        • 更简单快捷的解决方案
        • 请注意,这现在显示为“选择默认配置文件”
        【解决方案7】:

        我的 VS Code 版本:1.56.1(code --version)

        配置集成终端的用户设置:

        • Ctrl + Shift + P
        • 类型:用户
        • 选择:首选项:打开用户设置
        • 单击:打开设置 (JSON) 按钮(靠近右上角)

        settings.json:

        {
            "terminal.integrated.tabs.enabled": true,
            "terminal.integrated.shell.windows": "<your installation path>\\Git\\bin\\bash.exe",
            "terminal.integrated.defaultProfile.windows": "Git Bash",
            "terminal.integrated.profiles.windows": {
                "Git Bash": {
                    "path": "<your installation path>\\Git\\bin\\bash.exe",
                    "icon": "terminal-bash"
                },
                "Command Prompt": {
                    "path": "${env:windir}\\System32\\cmd.exe",
                    "icon": "terminal-cmd"
                },
                "Windows PowerShell": {
                    "path": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                    "icon": "terminal-powershell"
                }
            }
        }
        

        terminal.integrated.defaultProfile.windows

        此属性只会在您点击“添加新终端”(“+”)按钮时将 GitBash 设置为默认值。在启动时将其设为默认是不够的。

        terminal.integrated.shell.windows

        将显示贬损警告。但需要此配置以使选定的 shell(此处为 GitBash)在启动时默认。

        问题过滤

        在问题选项卡上,在输入字段旁边,单击过滤器图标,我选中了“仅显示活动文件”选项,以便在处理其他任何内容时使这个已弃用的错误消失。

        【讨论】:

          【解决方案8】:

          2021,VSC v.1.55.1

          如何将Git Bash 添加为默认Terminal,对于那些将Git Bash 安装在默认路径中的人:

          1. 在 Visual Studio Code 中打开 Settings 使用 Ctrl + ,
          2. a) 在Search settings(屏幕截图上的红色框)字段类型integrated automation b) 或者直接点击功能 -> 终端(ss 上的蓝色框)
          3. 点击任意在settings.json中编辑
          4. "terminal.integrated.shell.windows": " " 字段中输入您的bash.exe 位置

          注意 1:因为它是 JSON 文件,请记住在您的路径中使用双精度 \\ 而不是 \

          注意2:不要混淆bash.exe(它在bin文件夹中)和git-bash.exe,在第一种情况下bash终端将留在VSC中,在第二种情况下它将被打开外部。

          【讨论】:

            【解决方案9】:

            要在 Visual Studio Code 中打开终端,您不需要在任何地方都使用 Ctrl + `,因为它非常不方便手指操作。更好的解决方案是:

            Ctrl + j
            

            【讨论】:

              【解决方案10】:

              在最新的稳定版本中,即 1.54,禁用 ConPTY 解决了我的问题。我正在写这篇文章,以防它也能解决你的问题。

              {
              
               "terminal.integrated.shell.windows": "C:\\path\\to\\bin\\bash.exe",
               "terminal.integrated.windowsEnableConpty": false
              }
              

              【讨论】:

                【解决方案11】:

                您不再需要手动输入 bash.exe 路径。此答案已弃用。如果您在默认路径中安装了 git,现在您可以直接切换到 bash。如果您将 git 安装到不同的路径,则需要使用以下解决方案。


                https://git-scm.com/download/win 安装 Git。

                然后打开 Visual Studio Code 并使用 Ctrl + Shift + P 打开命令面板。然后输入“打开用户设置”,然后从下拉菜单中选择“打开用户设置”。

                然后此选项卡将打开,左侧为默认设置,右侧为您的设置:

                现在将这行代码复制到您自己的设置页面(右侧窗格)并保存 - "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

                注意: "C:\\Program Files\Git\bin\bash.exe" 是 Git 安装中 bash.exe 文件所在的路径。如果您使用的是适用于 Linux 的 Windows 子系统 (WSL) Bash shell,则路径为 "C:\Windows\System32\bash.exe"

                现在按 Ctrl + ` 从 Visual Studio Code 打开终端。你将拥有 Bash -

                【讨论】:

                • 两个信息,这可能会有所帮助:确保在编写路径时转义 json 中的反斜杠字符。还要确保在 vscode 中包含 64 位版本的 git bash,因为默认情况下 32 位版本可能没有颜色。 (只需从路径中删除“(x86)”部分)
                • 添加到Lajos,如果还是看不到终端打开,尝试重启vscode。
                • 我遇到了"terminal.integrated.shell.windows": "C:\\Program Files\\Git\bin\bash.exe" 的问题,终端没有打开。试过"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"。非常适合我。
                • 仅供参考,请确保链接到bash.exe,而不是git-bash.exe。后者将在 VS 代码外部打开一个终端作为单独的窗口,而 bash.exe 将在 VS 代码内部运行。
                • 如何在用户设置中找到settings.json,这里没有提到,我不得不用VSCode玩一点才能找到它。我们需要在“搜索设置”文本框中输入“终端”,你会看到一个链接“在settings.json中编辑”,你需要点击这里。
                【解决方案12】:

                独家报道用户:

                "terminal.integrated.shell.windows": "C:\\Users\\[YOUR-NAME]\\scoop\\apps\\git\\current\\usr\\bin\\bash.exe",
                "terminal.integrated.shellArgs.windows": [
                  "-l",
                  "-i"
                ],
                

                【讨论】:

                  【解决方案13】:

                  对我来说,这是唯一有效的组合!

                  "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
                  "terminal.integrated.shellArgs.windows": [
                    "--command=usr/bin/bash.exe",
                    "-l",
                    "-i"
                  ]
                  

                  使用 git-bash.exe 作为...shell.windows,每次 bash 在 VS 外部打开时!!

                  感谢上帝,它终于成功了!!否则,我打算彻底清除 VS 并重新安装它(让我重新安装所有扩展程序并重做我的自定义!)

                  【讨论】:

                  • 这对我很有帮助。我按照上面之前的答案让 bash 工作,但是我丢失了所有的 bash 和 git 别名。这把他们买回来了。谢谢。
                  • 这对我有用: "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe", "terminal.integrated. shellArgs.windows": [ "--login", "-i" ]
                  • 这个解决方案也对我有用。需要注意的是,在我的情况下,为了减少 gitbash 的滞后,请关注这篇文章 stackoverflow.com/questions/32232978/… 并在 Windows 中设置一个新的 HOME 环境变量。为了让它在 VSCode 中正常工作,上面的答案很完美。
                  【解决方案14】:

                  如果您已经拥有 "bash"、"powershell""cmd" CLI 并具有正确的路径设置,则可以通过以下方式从一个 CLI 切换到另一个 CLI方式。

                  Ctrl + ' :使用默认 CLI 打开终端窗口。

                  bash + enter :从您的默认/当前 CLI 切换到 bash CLI。

                  powershell + enter :从您的默认/当前 CLI 切换到 powershell CLI。

                  cmd + enter :从默认/当前 CLI 切换到 cmd CLI。

                  我使用的 VS Code 版本是 1.45.0

                  【讨论】:

                    【解决方案15】:

                    更新:较新版本的 Visual Studio Code 在终端下拉菜单中有 Select Default Shell 命令:

                    请记住,它只列出了 %PATH% 环境变量中的 shell。对于不在您的路径中的 shell,请参阅其他答案。

                    额外提示:当你启动 bash 时它只会执行.bashrc,如果你在.bash_profile 中有初始化命令,你必须将它复制到.bashrc。在 Git Bash 中使用 Conda enviroments 是必不可少的。

                    1.36 版之前(2019 年 6 月)

                    现在最简单的方法(至少从 Visual Studio Code 1.22 开始)是键入 Shift + Ctrl + P 打开 Shift em>命令面板并输入:

                    Select Default Shell
                    

                    现在您可以轻松地在路径中找到的shell之间选择您喜欢的shell:

                    对于不在您的 %PATH% 中的 shell,请参阅其他答案。

                    the complete Visual Studio Code shell reference。有很多肉的东西。

                    【讨论】:

                    • 这是我一直在寻找的答案。我想使用 WSL Bash,但其他答案是尝试使用 git 附带的 bash
                    • 有没有办法打开一个特定的外壳......而不是让它成为“默认”?我认为有一次“打开 'bash' 是有道理的。”
                    【解决方案16】:

                    分离或无关的 shell 和 code [args] 支持怎么样?

                    虽然其他答案谈论如何配置和使用 VScode 集成的 WSL bash 终端支持,但它们并没有解决“分离的外壳”的问题:不是从 VScode 中启动的外壳,或者以某种方式获得“从与 IDE 关联的 VScode 服务器实例断开连接。

                    这样的 shell 可能会出现如下错误:

                    Command is only available in WSL or inside a Visual Studio Code terminal.

                    或者...

                    Unable to connect to VS Code server. Error in request

                    Here's a script 很容易解决这个问题。

                    我每天都使用它来将 tmux 会话中的 shell 与特定的 VScode 服务器实例连接起来,或者修复与其托管 IDE 分离的集成 shell。

                    #!/bin/bash
                    # codesrv-connect
                    #
                    #  Purpose:
                    #     Copies the vscode connection environment from one shell to another, so that you can use the
                    #     vscode integrated terminal's "code [args]" command to communicate with that instance of vscode
                    #     from an unrelated shell.
                    #
                    #  Usage:
                    #    1.  Open an integrated terminal in vscode, and run codesrv-connect
                    #    2.  In the target shell, cd to the same directory and run
                    #       ". .codesrv-connect", or follow the instruction printed by codesrv-connect.
                    #
                    #  Setup:
                    #    Put "codesrv-connect somewhere on your PATH (e.g. ~/bin)"
                    #
                    #  Cleanup:
                    #    - Delete abandoned .codesrv-connect files when their vscode sessions die.
                    #    - Do not add .codesrv-connect files to git repositories.
                    #
                    #  Notes:
                    #     The VSCODE_IPC_HOOK_CLI environment variable points to a socket which is rather volatile, while the long path for the 'code' alias is more stable: vscode doesn't change the latter even across a "code -r ." reload.  But the former is easily detached and so you need a fresh value if that happens.  This is what codesrv-connect does: it captures the value of these two and writes them to .codesrv-connect in the current dir.
                    #
                    #   Verinfo: v1.0.0 - les.matheson@gmail.com - 2020-03-31
                    #
                    
                    function errExit {
                        echo "ERROR: $@" >&2
                        exit 1
                    }
                    
                    [[ -S $VSCODE_IPC_HOOK_CLI ]] || errExit "VSCODE_IPC_HOOK_CLI not defined or not a pipe [$VSCODE_IPC_HOOK_CLI]"
                    if [[ $(which code) != *vscode-server* ]]; then
                        errExit "The 'code' command doesn't refer to something under .vscode-server: $(type -a code)"
                    fi
                    cat <<EOF >.codesrv-connect
                    # Temp file created by $(which codesrv-connect): source this into your working shell like '. .codesrv-connect'
                    # ( git hint: add ".codesrv-connect" to .gitignore )
                    #
                    cd "$PWD"
                    if ! test -S "$VSCODE_IPC_HOOK_CLI"; then
                        echo "ERROR: $VSCODE_IPC_HOOK_CLI not a socket. Dead session."
                    else
                        export VSCODE_IPC_HOOK_CLI="$VSCODE_IPC_HOOK_CLI"
                        alias code=$(which code)
                        echo "Done: the 'code' command will talk to socket \"$VSCODE_IPC_HOOK_CLI\" now."
                        echo "You can delete .codesrv-connect when the vscode server context dies, or reuse it in other shells until then."
                    fi
                    EOF
                    
                    echo "# OK: run this to connect to vscode server in a destination shell:"
                    echo ". $PWD/.codesrv-connect"
                    
                    

                    【讨论】:

                    【解决方案17】:

                    我从 vscode 1.42.1 开始尝试上述答案,他们的工作是让我得到一个 git bash 终端。因此,最重要的是,此设置仅适用于从终端打开 bash shell:

                    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
                    

                    但是,它也有不想要的副作用,即它也是用于构建事物的 shell,并且会破坏 MS C++ 链,因为 bash 将用于路径分隔符的 \ 字符理解为转义字符。然后,我的完整修复需要我添加这个额外的变量,将其设置为 powershell:

                    "terminal.integrated.automationShell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
                    

                    现在,我可以让我的 bash 终端和 Ctrl-Shift-BF5 正常工作。

                    哦,正如其他海报所提到的,此信息的来源是VSCode's documentation

                    【讨论】:

                      【解决方案18】:

                      最新的 VS 代码:

                      • 如果您看不到 settings.json,请转到菜单文件 -> 首选项 -> 设置(或按Ctrl+,
                      • 设置出现,看到两个选项卡用户(默认选择)和工作区。转到用户 -> 功能 -> 终端
                      • 出现终端部分,见链接edit in settings.json。点击添加"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
                      • 保存并重新启动 VS 代码。

                      Bash 终端将反映在终端上。

                      【讨论】:

                        【解决方案19】:

                        按住 Ctrl + ` 打开终端。 在终端中,输入 bash 以在终端中使用 Git Bash。 注意:确保您的机器上安装了 Git Bash。

                        如果您想再次使用 PowerShell,只需在终端中输入 powershell。要使用 Windows 命令行,请在终端中键入 cmd

                        您选择的设置将用作您的默认设置。

                        【讨论】:

                        • 这为所选答案增加了更多价值
                        • 要“切换回 powershell”,您可能需要在默认 shell 中运行的 bash shell 中输入 exit,然后键入 powershell,因为 bash 不知道 powershell 是什么。
                        【解决方案20】:

                        这个答案与投票最多的答案相似,但有一个重要区别:之前关于这个问题的很多答案都集中在运行 Git Bash 而我的答案集中在运行 WSL重击

                        1. 在您的 Windows 10 计算机上启用适用于 Linux 的 Windows 子系统。

                        2. 打开 Visual Studio Code 并按住 Ctrl + ` 打开终端。

                        3. 使用 Ctrl + Shift + P 打开命令面板。

                        4. 类型 - Select Default Shell

                        5. 从选项中选择WSL Bash(不是Git Bash)。

                        1. 单击终端窗口中的+ 图标。新终端现在将是 WSL Bash 终端!

                        【讨论】:

                          【解决方案21】:

                          由于 Visual Studio Code 的最新更新,事情发生了一些变化。以下步骤对我有用。

                          1. Ctrl + Shift + P 打开 Visual Studio Code 命令面板。

                          2. 在文本区域输入&gt;preferences: Open Settings (JSON)

                          3. 在显示在您的 JSON 文件的末尾添加以下行 右侧窗格。

                            "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
                            
                          4. 关闭并重新打开您的 Visual Studio Code 实例。

                          【讨论】:

                            【解决方案22】:

                            我已经在WSL(Windows 上的 Ubuntu 上的 Bash)上设置了很多 conda 环境,所以我想在 Visual Studio Code 上使用相同的 Bash 安装。

                            为此,我只需在 Visual Studio Code 的设置中指定此特定 Bash 可执行文件的路径(而不是 Git-Bash):

                            "terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"


                            PS:要确保 Ubuntu on Bash 可执行文件安装在 Windows 机器上的位置,请打开 Command prompt(搜索:cmd)并运行:

                            where bash.exe

                            【讨论】:

                              【解决方案23】:

                              Git\bin 目录添加到Path 环境变量中。该目录默认为%ProgramFiles%\Git\bin。通过这种方式,您可以在每个终端(包括 Visual Studio Code 的集成终端)中简单地键入 bash 访问 Git Bash。

                              How to set the path and environment variables in Windows

                              【讨论】:

                                【解决方案24】:

                                我碰巧正在为一家Fortune 500 公司提供咨询,遗憾的是它是 Windows 7 并且没有管理员权限。因此,Node.js、Npm、Visual Studio Code 等被推送到我的机器上——我不能改变很多等等……

                                对于这台运行 Windows 7 的计算机:

                                以下是我的新设置。不工作的被注释掉。

                                {
                                    "update.channel": "none",
                                    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
                                    //"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
                                }
                                

                                【讨论】:

                                  【解决方案25】:

                                  我跟随 Paul DeCarlo 的 this tutorial 使用 Windows Subsystem for Linux (WSL) 中的 Bash,而不是 Git Bash for Windows 附带的。它们与答案中的上述步骤相同,但请在您的用户设置中使用以下步骤。

                                  "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe",

                                  这对我来说是第一次......这对于这些东西来说是罕见的。

                                  【讨论】:

                                  • 确实很少见。尖端
                                  【解决方案26】:

                                  这取决于你是仅在当前用户还是所有用户中安装了 Git Bash:

                                  如果它安装在所有用户上,则将"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe" 放入您的用户设置中(Ctrl + 逗号)。

                                  如果它仅安装在当前用户上,则将"terminal.integrated.shell.windows": "C:\\Users\\&lt;name of your user&gt;\\AppData\\Local\\Programs\\Git\\bin\\bash.exe" 放入您的用户设置(Ctrl + 逗号)。

                                  如果上面列出的方法不起作用,那么您应该尝试Christer's solution 上面写着 -

                                  如果您想要集成环境,您需要指向 Git 安装的 bin 文件夹中的 sh.exe 文件。

                                  所以配置应该是C:\\&lt;my-git-install&gt;\\bin\\sh.exe

                                  注意: sh.exe 和 bash.exe 在我看来完全一样。它们之间应该没有区别。

                                  【讨论】:

                                  • 这对我有用,因为我(出于某种原因)仅为当前用户安装了 git,但我通过以下方式访问了 json 设置:CTRL-SHFT-P 然后选择“首选项:打开设置(JSON)”感谢代码 sn-p!
                                  【解决方案27】:

                                  至少对我而言,这将使 Visual Studio Code 打开一个新的 Bash 窗口作为外部终端。

                                  如果您想要集成环境,您需要指向 Git 安装的 bin 文件夹中的 sh.exe 文件。

                                  所以配置应该是C:\\&lt;my-git-install&gt;\\bin\\sh.exe

                                  【讨论】:

                                    猜你喜欢
                                    • 1970-01-01
                                    • 1970-01-01
                                    • 2022-12-09
                                    • 2017-05-13
                                    • 1970-01-01
                                    • 2021-02-20
                                    • 2016-12-31
                                    • 2017-11-23
                                    • 2018-03-09
                                    相关资源
                                    最近更新 更多