Register-PSRepository and Register-PackageSource

to setup my internal powershell gallery I would use:

Register-PSRepository -Name myPSgallery -SourceLocation https://myurl -PublishLocation https://myurl

when and why I would want to run the following:

Register-PackageSource -ProviderName PowerShellGet -Name myPSGallery -Location https://myurl2

I’m not sure what it does exactly in this case? Is it adding additional location for packages to the one specified with -SourceLocation earlier or is this something else entirely?

A PS Repository is sort of a subset of a package source using just the PowerShellGet Provider. If you run get-packagesource you’ll see PSGallery listed with a ProviderName of PowerShellGet. If you register an internal powershell gallery via Register-PSRepository you’ll see that listed in Get-PackageSource as well, also with a PowerShellGet Provider. If you’re strictly dealing with powershell modules in your internal repository I don’t believe you ever need to do anything with Register-PackageSource.