Powershell – How to manually set PowerShell’s OneGet repository source to Chocolatey

powershell

The OneGet PowerShell module should ship with the default repository being Chocolatey. This is shown in the documentation found here. However when I run Get-PackageSource it returns PSGallery and MSPSGallery as the sources.

How can I manually set the package source to Chocolatey?

I have tried running:

Register-PackageSource -Name chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2/

But it returns a warning saying:

Unable to find package provider 'Chocolatey'

Best Answer

I was looking for the same. This works on the PowerShell version that comes with Windows 10 TP:

register-packagesource -Name chocolatey -Provider PSModule -Trusted -Location http://chocolatey.org/api/v2/ -Verbose