Closed ThomasAunvik closed 1 year ago
Another workaround to these issues, are to change the default shell of OpenSSH to be a bash shell. By installing git, and use the git bash terminal as the default shell.
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Users\user\AppData\Local\Programs\Git\bin\bash.exe" -PropertyType String -Force
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration
@ThomasAunvik Thanks for your contribution.
Closes #111 Closes https://github.com/appleboy/scp-action/issues/39
Possibly Closes: https://github.com/appleboy/scp-action/issues/3
Related Comment: https://github.com/appleboy/drone-scp/issues/50#issuecomment-676610485
Once this check passes, it will use commands specific command to it's operating shell. For example, at the command
rm -rf %s
would not work on either terminals, cause -rf is not a valid argument, the command exists for powershell, but not on the normal windows command line. So you would have to change that toDEL
command isntead, which is supported by both powershell and windows command line.Another fix is added is mkdir, though mkdir exists for the commandline, it returns an error when the folder already exists, and the -p argument is not valid for mkdir, and instead creates an actual folder called
-p
. This is why we useif not exist %s mkdir %s
, cause it checks if that folder exists before creating it. This works on the windows command line, but not on powershell, but if we can, we could also add a check for powershell and use a powershell command instead.