posh-git
posh-git copied to clipboard
Cannot `Add-PoshGitToProfile -AllHosts` in installation
During installation I struck this:
Add-PoshGitToProfile -AllHosts
Test-Path : Cannot bind argument to parameter 'LiteralPath' because it is an empty string.
At C:\Users\64211\Documents\WindowsPowerShell\Modules\posh-git\1.1.0\Utils.ps1:208 char:34
+ if (!(Test-Path -LiteralPath $profileDir)) {
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Test
PathCommand
C:\Users\64211> Add-PoshGitToProfile -AllHosts
WARNING: Skipping add of posh-git import to file '-AllHosts'.
WARNING: posh-git appears to already be imported in one of your profile scripts.
WARNING: If you want to force the add, use the -Force parameter.
C:\Users\64211>
I do not know if it matters but it is disconcerting
System Details
Forgive me. I am a reluctant and novice windows user. I am happy to be responsive if it will help fix something but I am not happy to learn to answer, accurately, the following things unless there is a clear reason.
- posh-git version/path: Latest
- PowerShell version: Latest
- Git version: Latest, but not relevant
- Operating system name and version: Windows. on a laptop.
To retrieve the system details, paste the following line into PowerShell, press Enter and then copy/paste the resulting output above.
"- posh-git version/path: $($m = Get-Module posh-git; '{0} {1} {2}' -f $m.Version,$m.PrivateData.PSData.Prerelease,$m.ModuleBase.Replace($HOME,'~'))n- PowerShell version: $($PSVersionTable.PSVersion)
n- $(
git --version)`n- OS: $([System.Environment]::OSVersion)"
posh-git version/path: $($m = Get-Module posh-git; '{0} {1} {2}' -f $m.Version,$m.PrivateData.PSData.Prerelease,$m.ModuleBase.Replace($HOME,'~'))`n- PowerShell version: $($PSVersionTable.PSVersion)`n- $(
>> git --version)`n- OS: $([System.Environment]::OSVersion)
posh-git : The term 'posh-git' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ posh-git version/path: $($m = Get-Module posh-git; '{0} {1} {2}' -f $ ...
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (posh-git:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
That did not go well!
Install-Module posh-git -Scope CurrentUser -Force
Import-Module posh-git
Add-PoshGitToProfile -AllHosts
That last instruction was where I started to see problems. But considering that posh-git
is: "...is not "recognized as the name of a cmdlet, function, script file,..." the problem may be more fundemental