据我所知PowerShell 存储库是 NuGet 存储库 https://devblogs.microsoft.com/powershell/setting-up-an-internal-powershellget-repository/...
GitHub 刚刚发布了他们的包注册表 https://github.blog/2019-05-10-introducing-github-package-registry/,我的公司目前将其用于 npm,但也有一个 NuGet 端点。
我可以访问 NuGet 端点(https://nuget.pkg.github.com/mycompany/index.json https://nuget.pkg.github.com/mycompany/index.json)和我的 GitHub 凭证,它返回一个有效的 json:
{
"version": "3.0.0-beta.1",
"resources": [
{
"@id": "https://nuget.pkg.github.com/mycompany/download",
"@type": "PackageBaseAddress/3.0.0",
"comment": "Get package content (.nupkg)."
},
{
"@id": "https://nuget.pkg.github.com/mycompany/query",
"@type": "SearchQueryService",
"comment": "Filter and search for packages by keyword."
},
{
"@id": "https://nuget.pkg.github.com/mycompany/query",
"@type": "SearchQueryService/3.0.0-beta",
"comment": "Filter and search for packages by keyword."
},
{
"@id": "https://nuget.pkg.github.com/mycompany/query",
"@type": "SearchQueryService/3.0.0-rc",
"comment": "Filter and search for packages by keyword."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "PackagePublish/2.0.0",
"comment": "Push and delete (or unlist) packages."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "RegistrationsBaseUrl",
"comment": "Get package metadata."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "RegistrationsBaseUrl/3.0.0-beta",
"comment": "Get package metadata."
},
{
"@id": "https://nuget.pkg.github.com/mycompany",
"@type": "RegistrationsBaseUrl/3.0.0-rc",
"comment": "Get package metadata."
}
]
}
我一直在尝试使用它来将其设置为本地计算机上的存储库(在理想情况下,我会将模块推送到我的 CI/CD 上并让人们可以使用它们)Install-Module
使用 GitHub 作为存储库):
PS C:> $gitHubCredential = Get-Credential
PS C:> (iwr https://nuget.pkg.github.com/mycompany/index.json -Credential $gitHubCredential).StatusCode
200
PS C:> Register-PSRepository -Name GitHub -SourceLocation https://nuget.pkg.github.com/mycompany -PublishLocation https://nuget.pkg.github.com/mycompany -Credential $gitHubCredential
Register-PSRepository : The specified Uri 'https://nuget.pkg.github.com/mycompany' for parameter 'SourceLocation' is
an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
At line:1 char:1
+ Register-PSRepository -Name GitHub -SourceLocation https://nuget.pkg. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (https://nuget.pkg.github.com/mycompany:String) [Register-PSRepository
], ArgumentException
+ FullyQualifiedErrorId : InvalidWebUri,Register-PSRepository
我正在尝试一些不可能的事情吗?