2
votes

I am trying to push package from Linux via dotnet-cli.
I have my own nuget server - via package https://www.nuget.org/packages/NuGet.Server/
Using following command: dotnet nuget push mypackage.nupkg

I have XML config with package source:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <config>
      <add key="DefaultPushSource" value="https://mynuget.azurewebsites.net/api/v2/package" />
   </config>
   <packageSources>
      <add key="MyNuget" value="https://mynuget.azurewebsites.net/api/v2/package" />
   </packageSources>
   <packageSourceCredentials>
      <MyNuget>
         <add key="Username" value="user" />
         <add key="ClearTextPassword" value="pass" />
      </MyNuget>
   </packageSourceCredentials>
   <apikeys>
    <add key="https://mynuget.azurewebsites.net/" value="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAV4A39UQG0kyF2wMV56X9wQAAAAACAAAAAAAQZgAAAAEAACAAAAABPigYqsJ8B9Vcs2e6SXGUKbqctjmrNyoUQz/6H7FSWwAAAAAOgAAAAAIAACAAAAAhm/tVYS41jbvn9NIL6IPHFSFDpBDL/fbBXzdTBSRvWRAAAACY41RYMpAJoSeSdq5paZCvQAAAADZRmyl+f4XYYnPpi1Ia9Kf0TsM6ddNXUL2sJIWXtQ6zNOliZ1IGlpU62c83v93siZp7GCRjj9fIoG6ixbK2Rxg=" />
  </apikeys>
</configuration>  

Error message which I am getting is:

warn : No API Key was provided and no API Key could be found for 'https://mynuget.azurewebsites.net/api/v2/package'.
 To save an API Key for a source use the 'setApiKey' command.
info : Pushing mypackage.nupkg to 'https://mynuget.azurewebsites.net/api/v2/package'...
info :   PUT https://mynuget.azurewebsites.net/api/v2/package/
info :   Forbidden https://mynuget.azurewebsites.net/api/v2/package/ 3898ms

It seems that nuget.config is completely ignored by dotnet-cli?

I also cannot pass --config-file parameter - getting error error: Unrecognized option '--config-file' but it should be possible as per documentation:
https://github.com/dotnet/docs/blob/master/docs/core/tools/dotnet-nuget-push.md

2

2 Answers

0
votes

I managed to get it to work by just putting my nuget.config in the same folder as the .nupkg file and running dotnet nuget push from that folder.

-1
votes

It seems the issue is described here: https://github.com/NuGet/Home/issues/4879 and it's still in the Open status.

It also looks like someone already created a fix: https://github.com/automotiveMastermind/condo/issues/50.