ProfK
ProfK

Reputation: 51064

Why does my Posh-Git prompt keep disappearing?

I've always used Phil Haack's method of installing Posh-Git, with the following PowerShell commands:

(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
install-module posh-git

The first line installs PsGet, and the second Post Git. I've also just tried install-module posh-git, having installed PsGet.

What happens is that the Post-Git prompt shows in the same PS Window I installed it in, but when I close that window and open another, Post-Git seems gone again.

This is a new machine, with a new Windows 10 Pro. Posh-Git worked on my old one, also with Windows 10 Pro, the only difference I know is the new one is SSD, and that shouldn't affect any of this.

Upvotes: 1

Views: 1224

Answers (2)

Maytham Fahmi
Maytham Fahmi

Reputation: 33397

I found this on GitHub useful, by @rkeithhill:

No worries. Once you've imported it, you can run the Add-PoshGitToProfile -AllHosts so that the next time you start PowerShell, posh-git will automatically get imported.

Upvotes: 1

Clijsters
Clijsters

Reputation: 4256

It seems that you are confusing Installing a module (Install-Module) with loading (importing) a module (Import-Module).

To import your module on every start of PowerShell:

...either create a prepared shortcut with a command line like %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -Command Import-Module posh-git

...or use PowerShell profiles.

I'd prefer the latter if you plan to import several modules (maybe based on special conditions). Please keep in mind anyway, that loading a heavy profile will affect your PowerShells startup performance.

Upvotes: 2

Related Questions