据我所知,PowerShell 存储库是 NuGet 存储库......
GitHub 刚刚发布了他们的包注册表,我的公司目前用于 npm,但也有一个用于 NuGet 的端点。
我可以使用我的 GitHub 凭据访问 NuGet 端点 ( https://nuget.pkg.github.com/mycompany/index.json ),它返回一个有效的 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
我在尝试一些不可能的事情吗?