【问题标题】:How to use 'dotnet restore' with a feed that need to authenticate with?如何将“dotnet restore”与需要进行身份验证的提要一起使用?
【发布时间】:2020-04-23 22:18:30
【问题描述】:

我的项目使用了一个自定义提要,我需要在使用它之前对其进行身份验证。 https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-restore 告诉我应该使用 --interactive 标志。然而,这并没有改变什么。我收到错误:

/usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5):错误:无法加载源https://myproject.pkgs.visualstudio.com/_packaging/MyFeed/nuget/v3/inde的服务索引 x.json。 [/home/xyx/code/MyApp.csproj] /usr/share/dotnet/sdk/3.1.201/NuGet.targets(124,5):错误:响应状态码不表示成功:401(未授权)。 [/home/xyx/code/MyApp.csproj]

如何授权我的提要?

【问题讨论】:

  • 我相信你想使用dotnet nuget add source:docs.microsoft.com/en-us/dotnet/core/tools/…来设置你的用户名和密码。
  • 我看到这允许添加 nuget 源。如果我已经将源代码添加到 NuGet.Config,我应该如何使用它?我尝试了多种方法,但都失败了。
  • 我不想将我的凭据存储在 git 存储库中的文件中
  • 您的凭据将存储在 C:\Users\YourName\AppData\Roaming\NuGet\NuGet.Config 中,而不是您的 git 存储库中。您的密码也将被加密。这就是我使用它的方式。我不知道还有什么其他选择。

标签: .net nuget


【解决方案1】:

要让 dotnet 要求您提供凭据,您需要安装 https://github.com/microsoft/artifacts-credprovider。它解决了问题。

【讨论】:

  • 这就是(最终)帮助我的!
猜你喜欢
  • 2012-01-30
  • 1970-01-01
  • 1970-01-01
  • 2021-08-16
  • 2014-03-29
  • 1970-01-01
  • 1970-01-01
  • 2021-10-16
  • 1970-01-01
相关资源
最近更新 更多