需要使Git Bash成为默认终端,但不是直接通过将路径设置为bash.exe
in "terminal.integrated.shell.windows":
,而是通过VS Code 界面:
那些。在此子菜单中选择“Git Bash”配置文件,或将其设置为默认配置文件:
但 VS Code 看不到“Git Bash”配置文件
settings.json
:
"terminal.integrated.profiles.windows": {
"Git Bash": {
//"source": "Git Bash",
"icon": "terminal-bash",
"path": "D:\\Web\\Git\\bin\\bash.exe"
},
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
}
}
VS Code
(在用户设置中
Code > User > settings.json
)结果:
从截图来看,有一个参数
-login
我没有输入,说明可能是在安装的时候设置的。卸载VS Code
了,重新安装。是的,确实bash
有,也许是因为这是最新版本 1.71.2。但是有一点,所有设置都必须完全包含在其中,{ }
否则它们不会被解释。发现问题。
出于某种原因,由于名称“Git Bash”,VS Code 不显示配置文件,如果您以某种方式更改名称本身,例如:“GitBash”、“Git-Bash”或“Git bash”,那么一切正确显示在选择默认配置文件的列表中。