Add-Type-AssemblyName System.IO.Compression.FileSystem |
functionUnzip |
{ |
param([string]$zipfile, [string]$outpath) |
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile,$outpath) |
} |
$url='https://github.com/PowerShell/Win32-OpenSSH/releases/latest/' |
$request= [System.Net.WebRequest]::Create($url) |
$request.AllowAutoRedirect=$false |
$response=$request.GetResponse() |
$file=$([String]$response.GetResponseHeader('Location')).Replace('tag','download') +'/OpenSSH-Win64.zip' |
$client=new-object system.Net.Webclient; |
$client.DownloadFile($file,'c:OpenSSH-Win64.zip') |
Unzip 'c:OpenSSH-Win64.zip''C:Program Files' |
mv 'c:Program FilesOpenSSH-Win64''C:Program FilesOpenSSH' |
powershell.exe-ExecutionPolicy Bypass -File 'C:Program FilesOpenSSHinstall-sshd.ps1' |
New-NetFirewallRule-Name sshd -DisplayName 'OpenSSH Server (sshd)'-Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 |
net start sshd |
Set-Service sshd -StartupType Automatic |
Set-Service ssh-agent -StartupType Automatic |
cd 'C:Program FilesOpenSSH' |
Powershell.exe-ExecutionPolicy Bypass -Command '. .FixHostFilePermissions.ps1 -Confirm:$false' |
$registryPath='HKLM:SOFTWAREOpenSSH' |
$Name='DefaultShell' |
$value='C:windowsSystem32WindowsPowerShellv1.0powershell.exe' |
IF(!(Test-Path$registryPath)) |
{ |
New-Item-Path $registryPath-Force |
New-ItemProperty-Path $registryPath-Name $name-Value $value-PropertyType String -Force |
} ELSE { |
New-ItemProperty-Path $registryPath-Name $name-Value $value-PropertyType String -Force |
} |
- Setup SSH Authentication for Git Bash on Windows Prepararation. Create a folder at the root of your user home folder (Example: C:/Users/uname/) called.ssh. Create the following files if they do not already exist (paths begin from the root of your user home folder).
- Q: What do I do if I'm still prompted for my password and GITSSHCOMMAND='ssh -v' git fetch shows no mutual signature algorithm? A: Some Linux distributions, such as Fedora Linux, have crypto policies that require stronger SSH signature algorithms than Azure DevOps supports (as of January 2021). There's an open feature request to add this support.
Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to GitHub Enterprise Server without supplying your username and personal access token at each visit. Checking for existing SSH keys Before you generate an SSH key, you can check to see if you have any existing SSH keys.
commented Nov 3, 2020
Openssh Github
Install Win32 OpenSSH (test release)
Openssh For Windows 10
Win32-OpenSSH Github releases can be installed on Windows 7 and up.
Note these considerations and project scope first.
Download the latest build of OpenSSH.To get links to latest downloads this wiki page.
Extract contents of the latest build to
C:Program FilesOpenSSH
(Make sure binary location has the Write permissions to just to SYSTEM, Administrator groups. Authenticated users should and only have Read and Execute.)In an elevated Powershell console, run the following
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
Open the firewall for sshd.exe to allow inbound SSH connections
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
Note:
New-NetFirewallRule
is for Windows 2012 and above servers only. If you're on a client desktop machine (like Windows 10) or Windows 2008 R2 and below, try:Start
sshd
(this will automatically generate host keys under %programdata%ssh if they don't already exist)net start sshd
Optional
- To configure a default shell, see here
- To setup
sshd
service to auto-startSet-Service sshd -StartupType Automatic
- To migrate sshd configuration from older versions (0.0.X.X), see here
Openssh Github Web
Uninstall Win32 OpenSSH
- Start Windows Powershell as Administrator
- Navigate to the OpenSSH directory
cd 'C:Program FilesOpenSSH'
- Run the uninstall script
powershell.exe -ExecutionPolicy Bypass -File uninstall-sshd.ps1