学无先后,达者为师

网站首页 编程语言 正文

新版本VS Code 终端设置为git bash

作者:致远鸭 更新时间: 2022-04-17 编程语言

原教程

原教程是在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目录,添加到到配置文件 setting.json 中即可

    "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

原文链接:https://blog.csdn.net/A_zhiyuan/article/details/116930325

栏目分类
最近更新