windows系统:将 Git Bash 设置为 VSCode 的终端

563 阅读1分钟
  1. 打开你的git bash 终端 snipaste_20211222_173626.png

  2. 输入 where bash ,查看你的 bash 安装地址

image.png

3.打开你的 VSCode 的设置

image.png 4.在设置的 搜索框中输入:terminal.integrated.profiles.windows

image.png 5.点击下方的————“在 settings.json 中编辑”,进入到 settings.json 文件, 并在文件中插入如下字段:

  "terminal.external.windowsExec": "这里 粘贴 你在第二步得到的 bash 安装地址!例如:C:/ruanjian/Git/bin/bash.exe",
  "terminal.integrated.defaultProfile.windows": "Git-Bash",
  "git.path": "粘贴 你在第二步得到的 bash 安装地址!末尾的bash.exe改为git.exe,例如:C:/ruanjian/Git/bin/git.exe",
  "terminal.integrated.profiles.windows": {
    "Git-Bash": {
      "path": "这里 粘贴 你在第二步得到的 bash 安装地址!例如:C:/ruanjian/Git/bin/bash.exe",
      "args": []
    },
    "PowerShell": {
      "source": "PowerShell",
      "args": []
    }
  }
  1. 最后,关闭当前【所有的】VSCode窗口(重要!!!),然后重启 VSCode 编辑器,打开终端查看是否生效