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

标签 powershell nuget visual-studio-2019 nuget-package

我遇到了错误

"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 

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

  • 删除 Windows 凭据管理器中的所有凭据
  • 在 Visual Studio 包中删除并重新添加此包源 经理设置

我在项目目录中有一个 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 文件中为您的私有(private) nuget 包源添加 packageSourceCredentials:

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

</packageSourceCredentials>

更多信息可以引用this link .

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

关于powershell - 请提供凭据错误推送到 Azure DevOps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61528818/

相关文章:

powershell - Exchange Powershell-检查用户是否在特定的邮箱数据库中

Powershell - 将 SQLite 表导出到 csv

.net - 从packages.config 迁移到PackageReferences 导致无法加载文件或程序集 "..."或其依赖项之一。访问被拒绝

c# - 智能感知完成模式停止工作(错误?)

powershell - Powershell 中的递归 -Verbose

python - Windows 上的 Gcloud 命令(使用 git bash)正在记录错误 : WindowsApps/python3: permission denied

c# - 无法在Windows 10机器上构建IdentityServer4

c# - ASP.NET Core 1.0.0 Nuget 依赖问题

visual-studio - 检查工作的 C 编译器 : "cl.exe - skipped" : Visual Studio 2019

c++ - x86下划线前缀问题 : Calling NASM function from C++ function works in x64 but fails in x86