.net core 生成无推送作用域的Nuget API密钥
我正在使用Gitlab CI构建一个.NET核心项目,作为构建步骤的一部分,我需要连接到一个私有的Nuget存储库。我在gitlab-ci.yml中添加了以下几行,以将我的私有存储库添加为源.net core 生成无推送作用域的Nuget API密钥,.net-core,nuget,gitlab-ci,.net Core,Nuget,Gitlab Ci,我正在使用Gitlab CI构建一个.NET核心项目,作为构建步骤的一部分,我需要连接到一个私有的Nuget存储库。我在gitlab-ci.yml中添加了以下几行,以将我的私有存储库添加为源 build: stage: build script: - dotnet nuget add source "https://mynugetrepo.com/api/v2" --name "MyNugetRepo" --username $NUGET_
build:
stage: build
script:
- dotnet nuget add source "https://mynugetrepo.com/api/v2" --name "MyNugetRepo" --username $NUGET_USERNAME --password $NUGET_APIKEY --store-password-in-clear-text
- dotnet build
由于此步骤仅负责生成而不发布,我希望API密钥对我的存储库不具有任何发布权限,但是,当我尝试生成新的API密钥时,如果不添加一个或多个“推送”或“未列出包”范围,我将无法执行此操作,如下所示:
不幸的是,没有提供用户名和API密钥(即,dotnet nuget add source)https://mynugetrepo.com/api/v2“--name“MyNugetRepo”
)我根本无法访问存储库,出现错误:
Build FAILED.
/usr/share/dotnet/sdk/5.0.202/NuGet.targets(131,5): error : Failed to retrieve information about 'MyCoolProject' from remote source 'https://mynugetrepo.com/api/v2/FindPackagesById()?id='MyCoolProject'&semVerLevel=2.0.0'. [/builds/Cimpress-Technology/doccore-integration/artworkprocessing/artworkprocessing.sln]
/usr/share/dotnet/sdk/5.0.202/NuGet.targets(131,5): error : Response status code does not indicate success: 500 (Internal Server Error). [/builds/MyAccount/otherDirectory/someProject.sln]
提供用户名和API密钥密码可以解决此问题,但是否可以配置用于此生成步骤的“只读”API密钥?哪个软件托管nuget存储库?