Installation issues with Powershell 7 and Install-Module
I was trying to install posh-git under Powershell 7.5 using the README instructions, and the results were that it worked perfect in my Adminstrator windows, but the module was never visible under the normal user window.
After fiddling with Get-Module -ListAvailable , I finally figured out what was up: Installing via PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force was putting the module in my Documents directory, rather than the Powershell modules directory, and (for some reason that I still don't know) only Administrator looks in that directory for available modules.
I switched the install command to just PowerShellGet\Install-Module posh-git and it installed in the regular Powershell modules directory and started working perfect from all windows/users.
Is there a reason the install instructions recommend -Scope CurrentUser?
I followed your instructions and it does seem that Install-Module without the scope was required to get it listed via Get-Module. However, tab completion is still broken for me on Powershell 7, how about you @e-Dan-K ?
However, tab completion is still broken for me on Powershell 7, how about you @e-Dan-K ?
Is only tab completion broken, or is everything not working? (ie the prompt change, etc). Once you've gotten it listed via Get-Module, you still need to run the Add-PoshGitToProfile to get it to show up in your appropriate startup profile. Everything is working properly for me now.
Something that I noticed while debugging my issues (before I found that the module wasn't available in Get-Module) was that I didn't even have any of the profile files, so I manually created them (blank), thinking that might be problem. I don't know whether or not them not existing would have been a problem once the module was in the proper location.
While using a shorten PATH for the directory in Powershell with function prompt { "PS " + (get-location).drive.name+":..."+ $( ( get-item $pwd ).Name ) +">" } Posh-git does not work.
Is there a reason the install instructions recommend
-Scope CurrentUser?
Because it doesn't require machine-level permissions, which some unfortunate users don't have.
While using a shorten PATH for the directory in Powershell with
function prompt { "PS " + (get-location).drive.name+":..."+ $( ( get-item $pwd ).Name ) +">" }Posh-git does not work.
I assume the part that doesn't work is the prompt bit, which is because posh-git defines its own custom prompt function here from the script block here. In that block you can see the logic used to render the prompt, including available $GitPromptSettings properties like DefaultPromptPrefix and DefaultPromptPath that would allow you to customize what's shown before the Git status. Otherwise you can add $(Write-VcsStatus) to your own custom prompt and it will write just the Git status bit.