andy-5 / wslgit

Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)
MIT License
1.18k stars 59 forks source link

Shell "bash" is not executable: No such file or directory #119

Closed carlolars closed 2 years ago

carlolars commented 2 years ago

For some ssh-servers I need a Match host address exec "command" in my .ssh/config to run some command before doing the connection. From the ssh_config man page:

The exec keyword executes the specified command under the user's shell.

Unfortunately when wslgit starts bash inside wsl it use "bash" as the command, making the SHELL variable be set to just bash, which makes the execution fail with the error "Shell "bash" is not executable: No such file or directory".

The fix is to use /usr/bin/bash instead.

To test this, add the following to ~/.ssh/config:

Match host ssh-test exec "echo hello"

and then run the command wslgit clone git@ssh-test:repo.git and it will fail complaining about bash, when fixed it will instead fail with the error "ssh: Could not resolve hostname ssh-test: Name or service not known"

andy-5 commented 2 years ago

Fixed in e47e80f9e45a584468ac4d70c5b69a77a62f370e

Thanks again.