【问题标题】:How can I use a git bash terminal profile in Visual Studio 2019?如何在 Visual Studio 2019 中使用 git bash 终端配置文件?
【发布时间】:2020-09-18 09:46:49
【问题描述】:

Visual Studio 2019 最近在其 16.6 版本中添加了一个新的(急需的)终端功能。 这真的很棒,但我很难将 git bash 集成到配置文件中。

我已经尝试了一些变体的参数以及以下配置文件:

但每当我尝试选择该配置文件时,终端很快就会显示一个空白屏幕,然后打开默认的 PowerShell 终端。

我做错了什么以及如何正确配置配置文件?

【问题讨论】:

  • 这适用于 Visual Studio 16.8.3。

标签: bash terminal visual-studio-2019 git-bash


【解决方案1】:

如果您还没有弄清楚:您需要添加参数 -i(使 shell 交互),我还推荐 --login(使 shell 读取默认配置文件)。

尝试在参数字段中添加以下内容:

--登录-i

【讨论】:

  • 这个解决方案并没有改变我的结果。尝试打开配置文件会直接跳回 Powershell 配置文件。
【解决方案2】:

我在等待更好的解决方案时正在使用:

外壳位置:C:\WINDOWS\system32\cmd.exe 参数:/k ""%VSAPPIDDIR%..\Tools\VsDevCmd.bat" & bash"

本质上,我正在启动 cmd 并在启动时运行“bash”命令,有效地将 bash 终端嵌套在 cmd 中。

【讨论】:

  • 这对我有用。它在嵌入式终端中启动 Git Bash。太好了!
  • bash 不在我的 PATH 中,所以每当启动时我都会收到错误 'bash' is not recognized as an internal or external command, operable program or batch file.
  • 要么将 bash 添加到您的路径中,要么使用 bash.exe 的完整路径,而不仅仅是 bash(即 (...)VSAPPIDDIR%..\Tools\VsDevCmd.bat" & "C:\Program Files\GitOrSomething\bash.exe""
【解决方案3】:

我使用 C:\Program Files\Git\bin\bash.exe 作为 Shell 位置,它运行良好。

【讨论】:

    猜你喜欢
    • 2022-12-09
    • 2020-12-11
    • 1970-01-01
    • 1970-01-01
    • 2020-12-09
    • 2019-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多