将GitBash设置为VS Code的默认终端

这个东西搞了半天,真的无语。。。网上的东西都太旧了

注意:"terminal.integrated.shell.windows"2021年4月起已弃用。

1、首先打开设置

 2、进入settings.json,准备编辑设置文件

 3、编辑json文件中终端的安装路径

注意这里的终端名字一定要是GitBash不然识别不出来,我就是这里搞错了写成了Git Bash一直没有显示

{
    "workbench.colorTheme": "Default Dark+", 
    "files.autoSave": "onFocusChange",
    "git.path": "D:\\Program Files\\Git\\bin\\git.exe",
    "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": {
       //换成自己的Bash的安装路径   "path": "D:\\Program Files\\Git\\bin\\bash.exe", "icon": "terminal-bash" } },
  //默认终端的选择 "terminal.integrated.defaultProfile.windows": "GitBash", }

参考文献:

https://stackoverflow.com/questions/68068359/gitbash-not-showing-up-as-a-terminal-option-in-visual-studio-code

posted @ 2022-08-13 10:59  雨天尊  阅读(138)  评论(0编辑  收藏  举报