Skip to content

Dotnet paket push doesn't work #3843

Closed

Description

@halcwb

Describe the bug
When I try to dotnet paket push, this doesn't work:

c:\Development\lab\OriginalScaffold\dist>dotnet paket config add-token https://www.nuget.org  <MYAPIKEY>
Paket version 5.241.2
Performance:
 - Runtime: 372 milliseconds

c:\Development\lab\OriginalScaffold\dist>dotnet paket push OriginalScaffold.0.1.0.nupkg --verbose
Paket version 5.241.2
Pushing package OriginalScaffold.0.1.0.nupkg to https://nuget.org/api/v2/package - trial 1
No authorization found in config file.
Request failed with '403': 'https://www.nuget.org/api/v2/package'
Response body was:
Could not push OriginalScaffold.0.1.0.nupkg: Request to 'https://www.nuget.org/api/v2/package' failed with: 403 Forbidden - The specified API key is invalid, has expired, or does not have permission to access the specified package.

This what the paket.config file looks like:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <credentials>
    <token source="https://www.nuget.org" value="MYAPIKEY" />
  </credentials>
</configuration>

When I run the command with the api-key option and supply the api key manually it works.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new lib using the MiniScaffold template
  2. Add the nuget API key as is described with paket config add-token
  3. Create a package running thet DotnetPack target
  4. Try to manually publish the package after setting the key.

Expected behavior
Publishing of the package.

Activity

  1. added a commit that references this issue on Aug 31, 2026
    585fccf
  2. github-actions commented on Aug 31, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    I investigated this and found the root cause: the documented paket config add-token 'https://www.nuget.org' <token> example stores the token under https://www.nuget.org, but paket push (without --url) looks up credentials using the default source https://nuget.org (no www). Because credential matching was an exact string comparison, the stored token was never found, causing push to fail with the confusing 403/invalid-API-key error reported here.

    I've opened a fix that normalizes the www. prefix during credential lookup so tokens stored under either nuget.org or www.nuget.org are found regardless of which variant is used for push/add-token. See the linked pull request for details, tests, and trade-offs.

    Generated by 🌈 Repo Assist, see workflow run. Learn more.
    Comment /repo-assist to run again

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@ae8d551f07c7ed7619f8c58c7bb4c3ac89395d38
    
  3. added a commit that references this issue on Sep 1, 2026
    fa9d10d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions