dahlbyk / posh-git

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

Install and use posh-git #886

Open KevinBurton opened 2 years ago

KevinBurton commented 2 years ago

I installed posh-git. Now I am having an issue using it. From PowerShell I execute the command 'Import-Module posh-git' and I get the following error

Import-Module : File C:\Program Files\WindowsPowerShell\Modules\posh-git\1.0.0\posh-git.psm1 cannot be loaded. The file C:\Program
Files\WindowsPowerShell\Modules\posh-git\1.0.0\posh-git.psm1 is not digitally signed. You cannot run this script on the current
system. For more information about running scripts and setting execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Import-Module posh-git
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand

I am not sure how to proceed? Basically posh-git is not digitally signed so this cannot be executed with the execution policy of RemoteSigned?

rkeithhill commented 2 years ago

How did you install posh-git 1.0.0 for Windows PowerShell? Install-Module should take care of removing the internet zone identifier so it doesn't show up as a "remote" scirpt.

You can remove the internet zone identifier from these files by running:

Get-ChildItem ~\Documents\WindowsPowerShell\Modules\posh-git\1.0.0 -rec -file | Unblock-File
KevinBurton commented 2 years ago

Install-Module posh-git

On Tue, Jan 18, 2022 at 3:10 PM Keith Hill @.***> wrote:

How did you install posh-git 1.0.0 for Windows PowerShell? Install-Module should take care of removing the internet zone identifier so it doesn't show up as a "remote" scirpt.

You can remove the internet zone identifier from these files by running:

Get-ChildItem ~\Documents\WindowsPowerShell\Modules\posh-git\1.0.0 -rec -file | Unblock-File

— Reply to this email directly, view it on GitHub https://github.com/dahlbyk/posh-git/issues/886#issuecomment-1015836622, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUFM3VMD5GDGFH5GIGAFKLUWXJM7ANCNFSM5MICDFWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

rkeithhill commented 2 years ago

Did you try unblocking all of the module files? Install-Module should have done that but it's not exactly the most bug-free command. FWIW posh-git does work in Windows PowerShell v5 and an execution policy of RemoteSigned:

image