SCP is working fine when I set PowerShell as default shell and I am able to copy files to remote machine. if I set the default shell to Git-bash then SCP is not working ,throwing connection lost message.

Pathan Nazir 0 Reputation points
2024-04-02T11:06:51.9766667+00:00

I have two VM's (VM-1&VM-2) installed with window server 2022. on both the systems I have installed GIT.

case#1 : when power shell is the default shell : Run the bellow command on both VM's

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

SCP is working fine from VM-1 to VM-2 ,and I am able to copy files .

Case#2: when Gitbash is the default shell: Run the bellow command on both VM's

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force

scp is not working from VM-1 to VM-2 and showing lost connection message

kindly help me with this query ASAP.

Thanks

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,635 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 45,906 Reputation points
    2024-04-02T19:02:15.7533333+00:00

    Don't you need a shebang line at the start of the PowerShell script?

    For example: #!/usr/bin/env pwsh

    0 comments No comments