GitHub 使用 nuget 打包服务身份验证问题

GitHub Packages service authentication issue with nuget

所以我在使用 dotnet 工具时开始看到这个错误:

/usr/local/share/dotnet/sdk/6.0.100/NuGet.targets(130,5): warning : Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.

我在这方面看到的资源通常指向管道问题,但对我来说并非如此。

不确定是什么触发了这个或者为什么这为我解决了这个问题,但是如果我禁用并重新启用我的 nuget 源它对我有用。

dotnet nuget list source

应该return像这样:

Registered Sources:
  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json

那么您要禁用并重新启用它:

dotnet nuget disable source nuget.org
dotnet nuget enable source nuget.org