18

我已经使用一个空的 Web 应用程序和 nuget 服务器包设置了一个私有的 nuget 提要。一切正常,我可以从提要中检索,并且可以使用 Nuget 包资源管理器发布到私有提要。但我无法通过命令行发布 - 它会提示输入凭据。我已在 Appsettings 的 Web 应用程序中将 ApiKey 设置为一个简单的密码,并尝试将 ApiKey 添加到推送命令中。这提示我输入用户名,然后输入密码。我也尝试过 SetApiKey 命令,但我得到了相同的行为。在构建服务器上,我正在尝试相同的结果并获得相同的结果。

这是来自构建日志的错误消息(识别信息 x'd out)

nuget pack "C:\Builds\2\OE Phase II\Common\src\WebApi\Web.Http\Bxxxxxxxs.Web.Http.csproj" -IncludeReferencedProjects -Properties Configuration=Release
  nuget SetApiKey Bxxxxxxx1 -Source http://tfs12.xxxxxxxrps.com/Nuget
  nuget push *.nupkg -s http://tfs12.xxxxxxxrps.com/Nuget/
  C:\Builds\2\OE Phase II\Common\bin\xxxxxxx.Web.Http.dll
  1 File(s) copied
  Attempting to build package from 'xxxxxxx.Web.Http.csproj'.
  Packing files from 'C:\Builds\2\OE Phase II\Common\src\WebApi\Web.Http\bin\Release'.
  Using 'xxxxxxxs.Web.Http.nuspec' for metadata.
  Found packages.config. Using packages listed as dependencies
  Successfully created package 'C:\Builds\2\OE Phase II\Common\bin\xxxxxxxs.Web.Http.1.0.0.0.nupkg'.
  The API Key 'xxxxxxx' was saved for 'http://tfs12.xxxxxxxrps.com/Nuget'.
  Pushing Bxxxxxxxrs.Data 1.0.0.0 to 'http://tfs12.xxxxxxxrps.com/Nuget/'...
  Please provide credentials for: http://tfs12.xxxxxxxrps.com/Nuget/
  Object reference not set to an instance of an object.
  UserName: Password: 
4

6 回答 6

9

找到适用于 Windows Server 2012 和 Nuget.Server 2.8.5 的解决方案

  • 打开 IIS 管理器
  • 找到你的“Nuget.Server”应用程序
  • 右键单击并选择“编辑权限”
  • 转到“安全”选项卡

为“所有人”组添加“写入”权限。

于 2015-07-08T07:59:53.767 回答
1

API 密钥用于上传/推送包。看起来您启用了 http 代理,您可以通过调用 nuget.exe config 命令来设置用户名和密码。

一些例子:

nuget 配置 - 设置 HTTP_PROXY=http:// * .*。. -设置 HTTP_PROXY.USER=域\用户

nuget.config HTTP_PROXY

http://docs.nuget.org/docs/reference/command-line-reference

于 2013-12-02T23:39:52.020 回答
1

我也遇到了这个问题,我知道它以前有效,结果我正在使用 NuGet.exe 2.8.1 升级使用

NuGet.exe update -self 

把它带到 2.8.3,现在工作正常。

于 2015-02-10T13:58:58.127 回答
1

这对我有用:站点 > 身份验证 > 启用 Windows 身份验证(默认情况下我只有匿名)并且推送将使用您的域帐户而无需用户输入。

于 2015-07-23T23:42:16.107 回答
0

您还使用了哪个版本的 NuGet.Server 包?NuGet 已经发布了它的 2.7.2 版本。

您可以尝试查看 null ref 异常是否仍然重现吗?谢谢。

于 2013-12-02T23:43:42.120 回答
0

您可能会发现此 SO 答案很有帮助,因为它涵盖了如何在工作站和/或构建服务器上配置凭据,这需要通过命令行推送到需要身份验证的服务器(例如私人提要)。

发布不需要 API 密钥。

于 2013-12-19T01:08:56.223 回答