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"
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: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
: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"