Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing to private nuget feed Prompts for Credentials

I have set up a private nuget feed using a empty web application and the nuget server package. It is all working, I can retrieve from the feed, and I can publish to the private feed using the Nuget Package Explorer. But I cant publish via the command line - it prompts for credentials. I have set the ApiKey in the web application in the Appsettings, to a simple password, and I have tried adding the ApiKey to the push command. This Prompts me for a username and then a password. I have also tried the SetApiKey command but I get the same behavior. On the build server I am trying the same thing with the same results.

Here is the error messages from the build Log (identifying info 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: 
like image 475
Noel Avatar asked Nov 26 '13 21:11

Noel


People also ask

Can NuGet packages be private?

Once you create a NuGet package and have a . nupkg file, you can make the package available to other developers either publicly or privately.

Where are my NuGet credentials stored?

Globally: to make a credential provider available to all instances of nuget.exe run under the current user's profile, add it to %LocalAppData%\NuGet\CredentialProviders .

How do I host a private NuGet package?

Go to Tools > NuGet Package Manager > Package Manager Settings, select Package Manager Sources, and then click the + button. Choose feed Name, set the feed URL to: https://nuget.telerik.com/nuget, and click OK. Create or load your project. Go to Tools > NuGet Package Manager > Manage NuGet Packages for a solution.


2 Answers

Found solution for Windows Server 2012 and Nuget.Server 2.8.5

  • Open IIS manager
  • find your "Nuget.Server" application
  • right click and select "Edit permissions"
  • go to "Security" tab

Add "write" permission for group "Everyone".

like image 150
proforov Avatar answered Sep 18 '22 20:09

proforov


API key is for uploading/pushing packages. Looks like you have a http proxy enabled and you can set the username and password by calling nuget.exe config command.

Some example:

nuget config -Set HTTP_PROXY=http://*.*.. -Set HTTP_PROXY.USER=domain\user

nuget.config HTTP_PROXY

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

like image 40
Dan Liu Avatar answered Sep 20 '22 20:09

Dan Liu