visual-studionugetnuget-packagenuget-servernuget-spec

Nuget resource change from https to http


I try to upload a NuGet package but a receive this error:

An error was encountered when fetching 'PUT http://nuget_domain/api/v2/package/'. The request will now be retried.

But in the https://nuget_domain/v3/index.json is 'https://nuget_domain/api/v2/package'

Y want to know why it tries with http with it is configurated with https and how to fixed.

Regards


Solution

  • 1) First, please use the latest nuget.exe cli v5.7.0 from this link. Download it into the local path. And then copy its path into System Environment Variable PATH so that it can be called from CMD.

    2) Second, run this command under CMD to add your private nuget package source with username and password into the global nuget.config file. When you push a nuget package by CMD, it will read the file first so that you don't need to add some extra instructions.

    Before that, you should pay attention to your nuget sever path. Make sure that the link is right, you can also type the path into website to check whether it could return something.

    nuget sources add -Name "nuget path" -Source "https://nuget_domain/v3/index.json" -username "xxxx" -password "xxxx"
    

    add your username and password of the private nuget sever.

    If you want to update this nuget source, you could run:

    nuget sources update -Name "nuget path" -Source "xxxx" -username "xxxx" -password "xxxx"
    

    3) Third, then push the nuget package like this,

    nuget push xxx\xxx.nupkg -Source "nuget path" 
    

    Besides, if it still does not work, please try to use Step 2 to change your nuget package source to https://nuget_domain/. Not sure whether it works and hint from this github link.

    ====================

    If you use dotnet to push a nuget package, you could use this command:

    dotnet push xxx\xx.nupkg -s https://nuget_domain/v3/index.json --api-key xxxx --skip-duplicate