dahlbyk / posh-git

A PowerShell environment for Git
http://dahlbyk.github.io/posh-git/
MIT License
7.62k stars 802 forks source link

posh-git: The term 'posh-git' is not recognized as a name of a cmdlet, function, script file, or executable program. #947

Closed longtth closed 1 year ago

longtth commented 1 year ago

System Details

posh-git version: 1.1.0 (install from Powershell Gallery) posh-git path: not sure PowerShell version: 7.3.2 Git version: git version 2.36.0.windows.1 Operating system name and version: Windows 10 22H2

Issue Description

Tried to paste the command in the guide to terminal

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)"

and got this error

posh-git: The term 'posh-git' is not recognized as a name of a cmdlet, function, script file, or executable program.

image

dahlbyk commented 1 year ago

You need to include the quotes - it's one big string:

"- 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)"