Excute sh script using git-bash on Windows 10 using ssh

Viewed 281

I want to execute an sh script on a remote Windows 10 computer without logging into interactive shell.

On Linux I would do something like

ssh user@machine "echo execute program automatically && ./my_program "

However when I ssh into my Windows 10 machine using open-ssh server it opens by default cmd. In interactive mode I would now open git-bash

"C:\Program Files\Git\bin\sh.exe" --login

Then execute my script from there.

When I try to combine the commands like this

ssh user@machine ' "C:\Program Files\Git\bin\sh.exe" --login && ./my_program " '

the shell freezes. Without the single quotes, the command also doesn't work (obviously).

So what to do?

1 Answers

Try to change default shell, with administrator CMD :

reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d "C:\Program Files\Git\bin\sh.exe"
Related