gpt4 book ai didi

azure-devops - Azure Pipelines 无法与 Github 包一起使用

转载 作者:行者123 更新时间:2023-12-03 22:29:30 27 4
gpt4 key购买 nike

重现非常简单:

          - task: NuGetCommand@2
displayName: NuGet push
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg'
nuGetFeedType: 'external'
externalFeedCredentials: 'github-packages'
publishFeedCredentials: 'github-packages'
allowPackageConflicts: true
github-packages是项目中使用 PAT 的 NuGet 服务连接,该 PAT 具有对我的 GitHub 组织的完全访问权限。
我在日志中看到以下输出
2020-08-08T23:48:41.3089867Z [command]"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/msbuild.exe" /version /nologo
2020-08-08T23:48:42.7276911Z Caching tool: NuGet 5.4.0 x64
2020-08-08T23:48:42.7397600Z Found tool in cache: NuGet 5.4.0 x64
2020-08-08T23:48:42.7452624Z Resolved from tool cache: 5.4.0
2020-08-08T23:48:42.7453195Z Using version: 5.4.0
2020-08-08T23:48:42.7465530Z Found tool in cache: NuGet 5.4.0 x64
2020-08-08T23:48:42.8246178Z SYSTEMVSSCONNECTION exists true
2020-08-08T23:48:43.1624000Z SYSTEMVSSCONNECTION exists true
2020-08-08T23:48:43.8522322Z [command]C:\windows\system32\chcp.com 65001
2020-08-08T23:48:43.8632712Z Active code page: 65001
2020-08-08T23:48:44.2527739Z SYSTEMVSSCONNECTION exists true
2020-08-08T23:48:44.2733846Z Detected NuGet version 5.4.0.6315 / 5.4.0+d790b66be476cd901a56bd46ada037162097ee21.d790b66be476cd901a56bd46ada037162097ee21
2020-08-08T23:48:44.2752584Z 1b529ea0-989d-42e8-af13-8ba56ff0e7d8 exists true
2020-08-08T23:48:44.2836605Z [command]C:\hostedtoolcache\windows\NuGet\5.4.0\x64\nuget.exe sources Add -NonInteractive -Name httpsnugetpkggithubcomourorgindexjson -Source https://nuget.pkg.github.com/ourorg/index.json -ConfigFile d:\a\1\Nuget\tempNuGet_3286.config
2020-08-08T23:48:45.7706128Z Package source with Name: httpsnugetpkggithubcomourorgindexjson added successfully.
2020-08-08T23:48:45.7804645Z Using authentication information for the following URI: https://nuget.pkg.github.com/ourorg/index.json
2020-08-08T23:48:45.8355905Z [command]C:\hostedtoolcache\windows\NuGet\5.4.0\x64\nuget.exe setapikey *** -NonInteractive -Source httpsnugetpkggithubcomourorgindexjson -ConfigFile d:\a\1\Nuget\tempNuGet_3286.config
2020-08-08T23:48:46.4520785Z The API Key '***' was saved for 'https://nuget.pkg.github.com/ourorg/index.json'.
2020-08-08T23:48:46.4686061Z [command]C:\hostedtoolcache\windows\NuGet\5.4.0\x64\nuget.exe push d:\a\1\Build\M365Management.Console.0.2.83.nupkg -NonInteractive -Source https://nuget.pkg.github.com/ourorg/index.json -ApiKey *** -ConfigFile d:\a\1\Nuget\tempNuGet_3286.config -Verbosity Detailed
2020-08-08T23:48:49.1593595Z Unable to load the service index for source https://nuget.pkg.github.com/ourorg/index.json.
2020-08-08T23:48:49.1594103Z NuGet Version: 5.4.0.6315
2020-08-08T23:48:49.1594906Z Response status code does not indicate success: 401 (Unauthorized).
2020-08-08T23:48:49.1595523Z Using d:\a\_tasks\NuGetCommand_333b11bd-d341-40d9-afcf-b32d5ce6f23b\2.172.0\CredentialProviderV2\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe as a credential provider plugin.
2020-08-08T23:48:49.1596753Z NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://nuget.pkg.github.com/ourorg/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
问题似乎出在这一行:
...nuget.exe sources Add -NonInteractive -Name httpsnugetpkggithubcomourorgindexjson -Source https://nuget.pkg.github.com/ourorg/index.json -ConfigFile d:\a\1\Nuget\tempNuGet_3286.config
它将外部提要添加为源,但在添加时不使用服务连接 api key 。它只在 push 命令中使用 api key ……因此在尝试查询 https://nuget.pkg.github.com/ourorg/index.json 处的源时失败了。
我猜这只是 Azure DevOps 中的另一个损坏的功能,但希望得到一些确认。
谢谢。

最佳答案

在您的 nuspec 文件中,您有存储库元素吗?

<repository type="git" url="https://github.com/yourorganization/YourRepo" />
当您执行推送时,请改用 ApiKey:ApiKey 应该是具有写入包的访问权限的 PAT
enter image description here

关于azure-devops - Azure Pipelines 无法与 Github 包一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63321291/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com