0

I have just tried installing Posh-Git from the PowerShell gallery by copy and pasting this command:

Install-Module -Name posh-git -RequiredVersion 0.7.1

The command seems to run fine, i.e. there is a slight delay, and my PowerShell prompt returns. There are no success or error messages, yet I still don't have the special Posh-Git prompt in Git folders, and the C:\Users\brady\Documents\WindowsPowerShell\Modules folder is empty, implying no module was installed.

As suggested, using the -verbose switch gave the following output:

VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2/' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='posh-git'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'posh-git'.
VERBOSE: Skipping installed module posh-git 0.7.1.

Then checking the $error variable gave the following output:

Unable to find type [Microsoft.PowerShell.Commands.PowerShellGet.Telemetry].
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:715 char:26
+ ... yMethods = ([Microsoft.PowerShell.Commands.PowerShellGet.Telemetry] | ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power...llGet.Telemetry:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound
5
  • Did you try to run it with the -verbose option? Did that give you any more information? Did you check $error manually?
    – Seth
    Jan 30, 2018 at 6:34
  • @Seth I have now and included the output in my OP.
    – ProfK
    Jan 30, 2018 at 6:45
  • Could you try to remove the model (with verbose) and install it again (with verbose)? As you can see by the output, currently it's assuming that posh-git 0.7.1 is installed. Did you try to search for posh-git on your system?
    – Seth
    Jan 30, 2018 at 6:53
  • I uninstalled the module, which in found somewhere in program files, and re-installed it. The second install worked, but posh-git is still no giving me its special git prompt.
    – ProfK
    Jan 30, 2018 at 9:01
  • Did you import the module? Did you check the requirements and check what the prompt is set to?
    – Seth
    Jan 30, 2018 at 9:16

1 Answer 1

0

It sounds like you do not meet Posh-Git's Requirements or you did not import Posh-Git using Import-Module

Example:

PS C:\Users\user\Documents\code\Office365> #See no special git info
PS C:\Users\user\Documents\code\Office365> Import-Module posh-git
C:\Users\user\Documents\code\Office365 [develop ↑1 +1 ~0 -0 !]> 
2
  • I didn't use Import-Module. Once I use it, everything is fine. Last time I just installed it and it worked. How do I now get PS to import the module every-time I start it?
    – ProfK
    Jan 31, 2018 at 13:59
  • You can have it import automatically if you put the import statement in your PS profile. Easiest way to get there is to run something like Ise $profile or if you use vscode code $profile Feb 1, 2018 at 1:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .