powershellsitecoresitecore-mvc

Face difficulties on registering the SitecoreGallery repository


Want to install Sitecore9.1, first of all, try to register the repository in PowerShell.After running the following command get an error. Why error raise? need help to resolve this issue.

Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2

Error:

PackageManagement\Register-PackageSource : Module Repository 'SitecoreGallery' exists.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4173 char:17
+ ...     $null = PackageManagement\Register-PackageSource @PSBoundParamete ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceExists: (Microsoft.Power...erPackageSource:RegisterPackageSource) [Register-Pack
   ageSource], Exception
    + FullyQualifiedErrorId : PackageSourceExists,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSource

Solution

  • The error says that this repository already exists. First, check if it's registered properly:

    PS C:\> Get-PSRepository
    
    Name                      InstallationPolicy   SourceLocation
    ----                      ------------------   --------------
    PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2/
    SitecoreGallery           Untrusted            https://sitecore.myget.org/F/sc-powershell/api/v2
    

    If it is registered with incorrect data, you can change it:

    Set-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2