visual-studiomsbuildnuget

Getting 403 when trying to push packages to nuget.org


I've been following this document on How to Publish a Package to nuget.org gallery, and I keep getting 403 forbidden.

I've done the following steps:

  1. Browsed to my account in nuget.org.

  2. Clicked on my name -> API Keys

  3. Created an API key as such: enter image description here

  4. I already have a .nupkg file, so now I try:

$ nuget.exe push .\Test.1.2.3.nupkg -Source https://api.nuget.org/v3/index.json -Apikey <apikey>

And I keep getting:

Pushing Test.1.2.3.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Forbidden https://www.nuget.org/api/v2/package/ 2238ms
Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have permission to access the specified package.).

Why is that??


Solution

  • The error message said "The specified API key is invalid, has expired, or does not have permission to access the specified package."

    You can check this link

    If you're using a valid API key that you just created, then this message indicates a naming conflict, which isn't entirely clear from the "permission" part of the error. Change the package identifier, rebuild the project, recreate the .nupkg file, and retry the push command.

    Hope it can solve yout problem.