【发布时间】: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 存储库中。您的密码也将被加密。这就是我使用它的方式。我不知道还有什么其他选择。