【问题标题】:Unable to access NuGet sources无法访问 NuGet 源
【发布时间】:2019-03-05 07:25:58
【问题描述】:

我正在尝试从私人来源添加 NuGet 包; https://[provider].pkgs.visualstudio.com/[package]/nuget/v3/index.json(故意忽略提供者和包)。

我已将源代码添加到项目中的本地 Nuget.Config 文件中

<configuration>
    <packageSources>
        <add key="[name]" value="https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json" />
    </packageSources>
    <packageSourceCredentials>
        <[name]>
            <add key="Username" value="[username]" />
            <add key="Password" value="[password]" />
        </[name]>
    </packageSourceCredentials>
</configuration>

当我通过 CLI 请求源列表时,我得到以下信息

Registered Sources:

  1.  [name] [Enabled]
   https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json
  2.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json

但是,当我尝试将特定包添加到我的项目时,我收到以下错误

error: Unable to load the service index for source https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json.
error: Response status code does not indicate success: 401 (Unauthorized).

自然的解释当然是我输入了无效的凭据。但是,当我在浏览器中访问源代码时,我可以使用相同的凭据登录并检查 index.json 文件。

我想知道在添加私有 NuGet 源的过程中是否会遗漏一些东西?

(NuGet 版本:4.9.3.5777)

【问题讨论】:

    标签: nuget


    【解决方案1】:

    我刚刚发现我错过了什么。我需要安装 Azure Artifacts Credential Provider 并关注 GitHub 页面上的 instructions。

    【讨论】:

      猜你喜欢
      • 2014-07-24
      • 1970-01-01
      • 2014-10-21
      • 2023-03-22
      • 2017-08-01
      • 2020-08-06
      • 1970-01-01
      • 2012-12-20
      • 1970-01-01
      相关资源
      最近更新 更多