Git & SSH with Powershell Core

December 2018 ยท 2 minute read

In this post I want to give a quick outline of how to setup Powershell Core (Microsoft’s cross-platfrom version of Powershell) to work with git and ssh.

While you can simply install Git for Windows and work with Git Bash, personally I quite like Powershell Core, because it is more tightly integrated with Windows and Azure. I will not cover working with CMD, because in my personal opinion, CMD offers, to put it mildly, a suboptimal user experience …

So, let’s get started:

This will allow all users to execute scripts that have been remotely signed, i.e. are from the web. Optionally, you can also use "-Scope CurrentUser" if you only want to enable remotely signed scripts for your user account.

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force

## Update an existing version:
PowerShellGet\Update-Module posh-git

## Add PoshGit to all PowerShell hosts (console, ISE, etc)
Add-PoshGitToProfile -AllHosts

Now that we have Posh-Git up and running, let’s generate a public/private key-pair:

Now you should be ready to use git+ssh with Powershell:)