【问题标题】:Git Bash is not showing up as a terminal option in VSCodeGit Bash 未在 VSCode 中显示为终端选项
【发布时间】:2021-04-16 22:51:12
【问题描述】:

我正在运行 Windows 10 试图设置 git bash 终端,但 VSCode 没有检测到 Git 的安装或其他什么?

我正在研究如何设置它,方法是在终端窗口中执行“选择默认 shell”,然后选择 Git Bash,但这对我来说不是一个选项。 VSCode 和 Git 都已正常安装,所以我不明白为什么会发生这种情况?

我需要重新安装这两个应用程序吗?我宁愿不...有什么建议吗?

【问题讨论】:

    标签: windows visual-studio-code git-bash


    【解决方案1】:

    我建议您在 VS Code 设置文件中添加如下内容(使用适合您系统的路径)。

    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
    "terminal.integrated.shellArgs.windows": [
      "--command=usr/bin/bash.exe",
      "-l",
      "-i"
    ]
    

    这在https://code.visualstudio.com/docs/editor/integrated-terminal#_windows 讨论。

    您可能还需要在~/.bash_profile 中添加类似内容:

    ## make Backspace key and other things work in VS Code's Terminal emulator
    export TERM=xterm
    

    我在https://www.ii.com/git-bash-is-my-preferred-windows-shell/ 上写过关于这个以及更多内容的文章

    【讨论】:

    【解决方案2】:

    您可以先检查您的%PATH%:当 git.exe 在%PATH% 中时,VSCode 检测 Git 没有任何问题

    如果没有,请尝试在VSCode用户设置中设置Git: Path(需要输入git.exe的完整路径,包括git.exe本身)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-05
      • 2021-10-13
      • 2021-05-12
      • 2021-09-05
      • 2020-10-22
      • 2018-10-23
      • 2018-10-01
      • 2018-03-28
      相关资源
      最近更新 更多