You need to run two instances of PowerShell, one in Admistrator mode and another in regular mode.
In regular PowerShell:
NOTE: Remove
-AllowPrerelease
command if it doesn't work.
PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
Then run
PowerShellGet\Update-Module posh-git
..to make sure it's updated.
On your Admin-PowerShell, run:
Get-ExecutionPolicy
It should show: Restricted
.
Then run on the same Shell,
Set-ExecutionPolicy remoteSigned
give permission by typing y
.
Then run the following on your regular Shell:
Add-PoshGitToProfile
..to add posh-git to PowerShell profile so that it gets added to PowerShell everytime you open new instance of PowerShell.
Otherwise, you would have to run Import-Module posh-git
everytime you wannt use posh-git. Which is boring 💤
Go back to Admin-PowerShell and run:
Set-ExecutionPolicy restricted
..to make things as they were.
And now you should have posh-git on your PowerShell.
Enjoy! 🥂