sshd_config
没多大关系补充一个防火墙规格的shell脚本,便于复制。
# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) { Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..." New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 } else { Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists." }
(1) ssh克隆windows仓库的地址命名规则
#git clone 用户名@主机地址或主机名:具体的仓库地址 #用户名为windows用户名,可在windows设置功能中新增git用户 #主机地址为IP地址或者主机名 #仓库地址若在D盘test文件夹,则需要用/d/test,而不是D:/test #否则报找不到仓库的错误 Please make sure you have the correct access rights and the repository exists.
(2) 配置OpenSSH默认使用的shell
# 注意bash.exe的路径使用你自己的 New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force DefaultShell : C:\linxy\software\git\Git\bin\bash.exe PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE PSChildName : OpenSSH PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry
# 注意powershell.exe使用你自己的 New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
还原shell也可以参考官网信息