1. 程式人生 > 其它 >windows下修改vscode預設終端為git bash

windows下修改vscode預設終端為git bash

1.點選左下角的齒輪,展開點選設定

2.點選該處,開啟設定配置檔案,在配置檔案中,配置git的bash.exe的路徑

方法

參考官方文件,修改配置檔案,將下面的配置加到 setting.json檔案。

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

注意:上面的配置是要加到配置的大括號裡面的

注: 如不成功可採用如下配置:

vscode版本1.57.1 , 2021.6.28 可以使用這個, 地址修改自己的bash實際地址


{
"terminal.integrated.profiles.windows": {
"Command Prompt": {
"path": "D:\\install\\Git\\bin\\bash.exe",
"icon": "terminal-cmd"
}
},
"terminal.integrated.defaultProfile.windows": "Command Prompt",
}

評論區:解決第一次開啟一直為powershell
"terminal.integrated.profiles.windows": {
"Git-Bash": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe",
"args": []
},
"PowerShell -NoProfile": {
"source": "PowerShell",
"args": ["-NoProfile"]
}
},

把git bash放到上面,重啟vsc,第一次開啟terminal是git bash了。版本1.60.0。[滑稽]