Skip to content

Instantly share code, notes, and snippets.

@tejas-hosamani
Last active September 17, 2019 04:27
Show Gist options
  • Save tejas-hosamani/41262a29777274b76d854db45956d987 to your computer and use it in GitHub Desktop.
Save tejas-hosamani/41262a29777274b76d854db45956d987 to your computer and use it in GitHub Desktop.
These are steps to add `posh-git` on Windows PowerShell

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! 🥂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment