当通过 OpenSSH 远程连接到 Windows Server 2016 时,设置使用 git-bash 作为默认 shell

Cla*_*lay 7 ssh powershell openssh git-bash windows-server-2016

PowerShell的OpenSSH的网站有关于如何安装和使用OpenSSH很好的说明。

其中包括如何“配置默认的 ssh shell(可选)”

如果我选择使用 git-bash 而不是 powershell,-Value除了"/c"

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "/c" -PropertyType String -Force
Run Code Online (Sandbox Code Playgroud)

当我将默认 shell 设置为 git-bash 时,我得到一个空白屏幕。
我试过了"-c""-l -i"但没有一个工作,我仍然得到一个空白屏幕。

小智 10

这应该是你所需要的:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force
Run Code Online (Sandbox Code Playgroud)

  • `C:\Windows\System32\bash.exe` 也适用于在 Windows 上打开 WSL bash! (2认同)