6

I wanted to integrate git bash into IntelliJ, so I've changed the default terminal path to C:\Program Files\Git\bin\sh.exe. After some time I noticed that some commands are not working, for example:

sh.exe

$ ll                                                                                                                    
bash: ll: command not found

Also some programs are not working. I am using MQTT CLI, downloaded it, configured the PATH variable properly but the command mqtt is only working in git-bash.exe.

sh.exe

$ mqtt
bash: mqtt: command not found

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.

2 Answers 2

6

sh is a restricted shell that can only be used for Git operations. The documentation describes it as:

This is a login shell for SSH accounts to provide restricted Git access. It permits execution only of server-side Git commands implementing the pull/push functionality, plus custom commands present in a subdirectory named git-shell-commands in the user’s home directory.

This shell helps prevent you from accidentally running dangerous scripts when all you wanted to do is some Git work.

Bash, on the other hand, is a full Linux-like command environment, where you can run any installed software, both Windows CLI tools and special-built bash executables and scripts.

1
  • This answer is plain wrong. I have a fresh installation of Git for Windows and have executed c:\Program Files\Git\bin\sh.exe. In that shell, I typed notepad, and it opened notepad.exe, although there is definitely no subdirectory git-shell-commands in my home directory which would allow that, and although notepad.exe for sure is not a server-side Git command. Still looking for the equivalent of git-shell in Windows ...
    – Binarus
    Commented Mar 7, 2022 at 6:53
0

git-bash is an embedded system with all the stuff and libs to run git − and even more − including bash.

bash/sh is only the shell commander.

In your case, ll is an alias.

In git bash (which includes grep)

$ alias | grep ls
alias ll='ls -l'
alias ls='ls --color=auto'
…

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .