Windows 中 git-bash.exe 和 sh.exe 有什么区别?

Ian*_*ako 6 windows bash command-line git-bash

我想将 git bash 集成到 IntelliJ 中,因此我将默认终端路径更改为C:\Program Files\Git\bin\sh.exe. 一段时间后,我注意到有些命令不起作用,例如:

sh.exe

$ ll                                                                                                                    
bash: ll: command not found
Run Code Online (Sandbox Code Playgroud)

还有一些程序无法运行。我正在使用MQTT CLI,下载了它,PATH正确配置了变量,但该命令mqtt仅在git-bash.exe.

sh.exe

$ mqtt
bash: mqtt: command not found
Run Code Online (Sandbox Code Playgroud)

git-bash.exe

$ mqtt

Usage:  mqtt [-hV] { pub | sub | shell }

MQTT Command Line Interpreter.

Options:
  -h, --help      Show this help message and exit.
  -V, --version   Print version information and exit.

Commands:
  pub, publish    Publish a message to a list of topics
  sub, subscribe  Subscribe an mqtt client to a list of topics
  shell, sh       Starts MqttCLI in shell mode, to enable interactive mode with further sub commands.
Run Code Online (Sandbox Code Playgroud)

phy*_*fox 6

sh 是一个受限 shell,只能用于 Git 操作。文档其描述为:

\n\n
\n

这是 SSH 帐户的登录 shell,用于提供受限的 Git 访问。它仅允许执行实现拉/推功能的服务器端 Git 命令,以及 user\xe2\x80\x99s 主目录中名为 git-shell-commands 的子目录中存在的自定义命令。

\n
\n\n

当您只想做一些 Git 工作时,此 shell 有助于防止您意外运行危险的脚本。

\n\n

另一方面,Bash 是一个完全类似 Linux 的命令环境,您可以在其中运行任何已安装的软件,包括 Windows CLI 工具和专门构建的 bash 可执行文件和脚本。

\n