原教程是在setting.json配置文件中加上这句:

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

但新版本的vscode配置却提示错误:

This is deprecated, use #terminal.integrated.defaultProfile.windows# instead

1.png

点击“详细了解如何配置shell”
跳转至官网文档:https://code.visualstudio.com/docs/editor/integrated-terminal#_configuring-profiles
大致内容如下:

2.png

所以对着文档信息
把修改好的git pash目录,放到配置文件中即可

    "terminal.integrated.profiles.windows": {
        "Git Bash": {
          "path": "D:\\Program Files\\Git\\bin\\bash.exe"
        },
        "PowerShell -NoProfile": {
          "source": "PowerShell",
          "args": ["-NoProfile"]
        }
    },
    "terminal.integrated.defaultProfile.windows": "Git Bash",

重启vs code即自动选择git bash终端
也可根据自己要求,选择PowerShell终端
3.png

用代码书写山河的壮丽
本文作者:
文章标题:新版本VS Code 终端设置为git bash
本文地址:https://oddfar.com/archives/89/
版权说明:知识共享署名-非商业性使用 4.0 国际协议进行许可
转载声明:转载请附上原文出处链接和本声明
最后修改:2021 年 07 月 21 日 04 : 37 PM
如果觉得我的文章对你有用,请随意赞赏