2021年了, 如何将 Git Bash 设置为 VSCode 的终端?

简介: 2021年了, 如何将 Git Bash 设置为 VSCode 的终端?

今天打开 VSCode 准备撸代码,打开终端,结果发现原来配置的 bash 不能用了,只有 PowerShell 和 Command Prompt。这让人很不舒适,于是网上搜罗了一番了,可惜都是些陈芝麻烂谷子,没一个能用的。

原来我们是用的 "terminal.integrated.shell.windows" 来配置终端的,但是在 2021 年 4 月已经弃用了这个字段,现在要用最新的 "terminal.integrated.profiles.windows" 来配置,配置如下:

// settings.json
{
    // 终端配置
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "icon": "terminal-cmd"
    },
    "GitBash": {
      "path": ["C:\\Program Files\\Git\\bin\\bash.exe"],
      "icon": "terminal-bash"
    },
  },
  "terminal.integrated.defaultProfile.windows": "GitBash",
}

详细步骤:

  1. 打开“设置”

1688273619842.png在搜索框中搜索:terminal.integrated.profiles.windows


1688273636228.png

  • 点击下方:在 settings.json 中编辑,进入到 settings.json 文件
    之后将终端配置写进去,之后请看第 4 步。
    注意:
    a. "terminal.integrated.defaultProfile.windows": "GitBash" 这一条设置后,就会在打开终端后,默认使用 bash 作为终端了;
    b. Git Bash 的路径请填你自己电脑上 bash.exe 的位置。
  • 最后,务必重启 VSCode 编辑器,然后打开终端重试即可。
目录
相关文章
|
8月前
|
Shell Linux 网络安全
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
1368 3
宝塔服务器面板部署安装git通过第三方应用安装收费怎么办—bash: git: command not found解决方案-优雅草卓伊凡
|
开发工具 git C++
【App Service】VS Code直接部署App Service时候遇见 “fatal: not a git repository (or any of the parent directories): .git”
通过VS Code发布Python App Service的时候,遇见了发布失败错误: The deployment failed with error: fatal: not a git repository (or any of the parent directories): .git . Please take a few minutes to help us improve the deployment experience
370 24
|
开发工具 git 开发者
vscode+git解决远程分支合并冲突
通过这些详细步骤,您可以掌握如何使用VSCode和Git高效地解决远程分支合并冲突,提高开发效率和代码质量。希望这些内容对您的学习和工作有所帮助。
3508 86
|
人工智能 自然语言处理 JavaScript
Aider:27.6K Star!这个终端AI编程神器能用语音改代码,自动生成Git记录并提交,接入DeepSeek斩获编程基准最高分
Aider 是一款基于命令行的开源 AI 编程助手,支持多种编程语言和主流 LLM,可自动完成代码修改、Git 提交及语音交互。
3026 1
|
前端开发 开发工具 git
如何清理 docker 磁盘空间+修改 Gitea 服务器的 Webhook 设置+前端一些好学好用的代码规范-git hook+husky + commitlint
如何清理 docker 磁盘空间+修改 Gitea 服务器的 Webhook 设置+前端一些好学好用的代码规范-git hook+husky + commitlint
393 5
|
开发工具 git
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
359 3
|
缓存 Shell 开发工具
Git Bash⭐一、安装软件,与Git Bash基础命令
Git Bash⭐一、安装软件,与Git Bash基础命令
|
Java 开发工具 git
云效产品使用报错问题之流水线获取git版本号后将其设置为环境变量失败如何解决
本合集将整理呈现用户在使用过程中遇到的报错及其对应的解决办法,包括但不限于账户权限设置错误、项目配置不正确、代码提交冲突、构建任务执行失败、测试环境异常、需求流转阻塞等问题。阿里云云效是一站式企业级研发协同和DevOps平台,为企业提供从需求规划、开发、测试、发布到运维、运营的全流程端到端服务和工具支撑,致力于提升企业的研发效能和创新能力。
|
开发工具 git
文本,vitepress如何配置社区账号,如何设置git或者某站的社区账号,这里如何进行配置
文本,vitepress如何配置社区账号,如何设置git或者某站的社区账号,这里如何进行配置
|
开发工具 git
vscode设置 git提交代码忽略node_modules,dist,vscode如何设置不提交node_modules,dist
vscode设置 git提交代码忽略node_modules,dist,vscode如何设置不提交node_modules,dist
3052 0