VScode添加git bash终端

10,171 阅读1分钟

请确定版本大于或等于以下版本号再往下阅读
vscode版本:1.56.2

版本发布日期:2021年5月12日

前情提要

看了很多文章,都是将terminal.integrated.shell.windows配置项设置为bash.exe的路径,把git bash终端集成至vscode中。

添加git-bash.png

但是新版本的vscode提示不建议继续使用此方法:

This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in #terminal.integrated.profiles.osx# and setting its profile name as the default in #terminal.integrated.defaultProfile.osx#. This will currently take priority over the new profiles settings but that will change in the future.(2)

建议我们利用#terminal.integrated.profiles.osx##terminal.integrated.defaultProfile.osx#添加终端并配置为默认终端

配置过程

在官网查阅相关文档

首先,配置terminal.integrated.profiles.windows 添加profiles.png

添加Git Bash,path属性填写git的bash.exe路径
添加git bash.png

保存setting.json

然后,配置terminal.integrated.defaultProfile.windows

配置2.png

配置默认终端为Git Bash

配置3.png

保存setting.json

重启vscode即可