git - 如何在 Console2 中包装来自 Github for Windows 的 bash shell?

标签 git git-bash github-for-windows console2

我正在尝试让 Console2 包装 Github for Windows 的 bash shell。这并不像我希望的那么容易。使用来自 git-scm.com 的 Git for Windows,这非常容易。我知道我可以将那个 bash shell 与 Console2 一起使用没有问题,而且一直以来,我真的很好奇如何使用 Github for Windows bash shell 来做到这一点。由于 Github for Windows 和 Git for Windows 的名称相似,我在寻找解决方案时受挫。 enter image description here

从 git-scm.com mysysgit aka Git for Windows 包装 bash shell 非常简单,因为它带有一个 sh.exe。您只需在 Console2 设置中的 Shell: 字段中填写以下内容:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i

enter image description here

我的问题是如何让 Github for Windows bash shell 在 Console2 中打开?

在 Github for windows 中,Shell 字段没有简单的路径和可执行文件。你可以做的是进入 Github for Windows 的选项并设置一个自定义程序并将其指向 Console2,如下所示: enter image description here

真正的诀窍是什么进入了 Console2 设置?什么进入 Shell: 字段来获得 Console2 中的 bash shell?如果您在选择了 bash shell 的情况下查看 Github for Windows 的 shell 命令的目标,您会发现一些奇怪的东西:

C:\Users\10136196\AppData\Local\GitHub\GitHub.appref-ms --open-shell

这与 Github for Windows 使用的 Microsoft 一键安装功能有关,这在我的实验中的 Console2 设置 Shell: 字段中不起作用。

最佳答案

我直接从 Github for Windows 寻求帮助。我收到了非常迅速的回复,并提供了有效的解决方案。

有两个步骤:

1) 将默认 shell 的 Github for Windows 选项设置为自定义,并放置 Console.exe 的路径和可执行文件。我已经在这样做了,上面的问题中有屏幕截图。 (确保点击更新按钮以保存更改)

2) 在“选项卡”部分的 Console2“外壳”文本框中,您需要输入:

bash.exe --login -i

不需要路径,只有名为 bash.exe 的可执行文件(这对我来说很神奇)。控制台设置应如下所示:

enter image description here

一些陷阱...有人建议我在控制台 2 设置中将启动目录留空(我认为这是为了让 Gitub for Windows GUI 中的启动目录得到尊重)并且 Github for Windows 选项卡应该成为选项卡列表中的第一个。我发现的另一个问题是您不能再直接使用 Console.exe 来启动您的 shell。您必须使用已安装的 Github for Windows shell 快捷方式。
enter image description here

否则您将收到一条错误消息“无法启动 bash.exe --login -i!”

关于git - 如何在 Console2 中包装来自 Github for Windows 的 bash shell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23397236/

相关文章:

bash - 列出所有以 string 开头的 git 本地分支

git - 配置 Git 客户端,例如 GitHub for Windows,不要求身份验证

git - 如何使用git只获取提交历史,而不是文件

windows - PowerShell 命令的程序路径在哪里?

git - 如何在 Git Bash 中初始化 Composer 项目?

git-commit - 适用于 Windows 的 GitHub : How to commit only a part of the file?

git - 远程GitHub中的灰色图标是什么意思

git - 如何告诉 Git 这是同一个目录,只是名称不同

git - 输入git commit -m “My message”时出现错误

python - Winpty 和 Git Bash