请提供凭据错误推送到 Azure DevOps

Please provide credentials error pushing to Azure DevOps

我遇到错误

"Please provide credentials for: https://jbright.pkgs.visualstudio.com/Project/_packaging/Project_Feed/nuget/v3/index.json"

来自 Visual Studio 2019 Community Powershell 当我 运行 命令时:

nuget push -Source https://jbright.pkgs.visualstudio.com/Project/_packaging/Project_Feed/nuget/v3/index.json -ApiKey az C:\Users\Jens\source\repos\Project\Packed\Project.Core.0.4.0.7.nupkg 

我已经尝试了我能够在网上找到的解决此问题的方法,包括:

我在项目目录中有一个 nuget.config 文件,其中包含:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="Core_Feed" value="https://jbright.pkgs.visualstudio.com/Project/_packaging/Project_Feed/nuget/v3/index.json" />
  </packageSources>
</configuration>

<!--

nuget push -Source https://jbright.pkgs.visualstudio.com/Project/_packaging/Project_Feed/nuget/v3/index.json -ApiKey az C:\Users\Jens\source\repos\Project\Packed\Project.Core.0.4.0.7.nupkg  

-->

我在文件中保留了 powershell 命令语法,所以我不会忘记它,但正如您所见,它被注释掉了。问题是,这在我的笔记本电脑上使用相同的文件运行良好。

当我删除凭据管理器中的凭据,然后从此 Azure DevOps 提要中提取包时,我得到了包并看到新凭据已添加到 Windows。但即便如此,我还是无法在没有收到“请提供凭据”错误的情况下将包裹发送到提要。

知道如何解决这个问题吗? 谢谢, 詹斯

When I delete the credentials in credential manager and then pull packages from this Azure DevOps feed, I get the packages and see the new credentials added to Windows. But even so, I cannot pucs a package to the feed without getting the "Please provide credentials' error.

首先,请尝试使用来自this link的最新版本的nuget.exe cli,然后从本地配置nuget.exe cli路径代理进入系统环境变量 PATH.

其次,您应该在 Nuget.config 文件中为您的私有 nuget 包源添加 packageSourceCredentials

<packageSourceCredentials>
    <Core_Feed>
        <add key="Username" value="xxx" />
        <add key="Password" value="xxx" />
       xxx
    </Core_Feed>

</packageSourceCredentials>

更多信息可以参考this link

然后,测试是否可以推送你的nuget包。