Github package registry not compatible with dotnet nuget client

Hi @gustavdw,

Thank you for being here!  Unfortunately, at present - we only support the documented build tools and clients, in this case nuget.

I will however pass this back as a feature request, and this is something we are exploring going forwards - as each of these package formats support a wide range of build tools and clients beyond the ‘default’ option.

Keep an eye on our documentation and for updates.

1 Like

Any updates on this? It’s quite a significant blocker.


There is a workaround using curl here, at least until GitHub fixes problem of not allowing the apiToken to work directly using the nuget push command.


@andreagriffiths11, I’m not sure if you read the original message. @gustavdw specifically said “All instructions followed.”

I also am attempting to use this feature, exactly as documented here, and getting exactly the same error message. I’ve tried both with dotnet nuget push and regular nuget push.

Unfortunately, the error / incorrect documentation make this feature a non-starter for my company as well.


@andreagriffiths11 Month later, issue still exists without any update from your end…

Hey Friends,

My sincere apologies for the delay on update here. This issue should now be resolved, please let us know if you are still having any problems. 

To try out bundling and publishing the package using the dotnet cli: 

Here’s a guide on how to configure this:

Your personal access token will need to have repo, package:read and package:write scopes: dotnet tool install gpr -g --version 0.1.13-beta gpr push path/to/your.nupkg -k <token> gpr list -k <token>.


Same error. Still doesn’t work. 

1 Like

I got it to work using gpr, but the help doc says to use dotnet nuget which still does not work.

Are there any updates to this? It’s difficult to understand whether this is a GitHub Packages or ‘dotnet nuget’ CLI issue. I have raised the following issue on the NuGet repo:

@andreagriffiths11 This is still an issue months on. Has this been routed to the right people? Is this issue being looked at? A lot of .NET developers are having the same issue. Somebody even wrote a whole tool to workaround this issue:

Hi @RehanSaeed :wave:

This appears to be a tricky issue to chase down. :cry:

See the following issue:

  • .NET Core 2.2 - HttpClient throws IOException: The server returned an invalid or unrecognized response. dotnet/runtime#28582

Could you try setting the following env var when you call dotnet nuget push?


There is something very odd going on!


This is frustrating. It’s an open issue since October 1st, 2019 and we’re July 27th, 2020.
When will this be solved?

Thanks for the ping @RehanSaeed. The team is actively working on this (@jcansdale) Is an Engineer in that team. Would you mind following the steps they’ve shared below? :pray: I appreciate your patience and apologize for the inconvenience this is created.

I’m not actually on this team, but my background is in .NET development and I’ve been doing what I can to raise visibility of this issue.

I’ve dug into it a fair bit myself and it isn’t at all obvious what’s going wrong. If you put it through Fiddler, you’ll find it starts working consistently (a heisenbug :confused:).


:woman_facepalming:t4: My mistake @jcansdale, thank you so much for looking into this.

1 Like

@andreagriffiths11 @jcansdale Any news on a potential fix for this? There are open source projects which are deciding not to publish to GitHub packages because of this bug.

To be clear we did not choose to abandon GitHub packages because of issues that the dotnet nuget client has. Personally I have always found the dotnet nuget tool to be useless, and recommend that you use the nuget client directly.

I tried using dotnet nuget push and nuget push for Github package and both failed.

I was manage to push .nupkg properly with gpr dotnet tool though

dotnet tool install -g gpr --no-cache -v q
gpr push --api-key $GITHUB_ACCESS_TOKEN "YourPackage.1.2.3.nupkg"

Hi we have our console spammed with the message Please use the --api-key and --source options when publishing to GitHub Packages when running dotnet restore.
With the following following nuget.config file

<?xml version="1.0" encoding="utf-8"?>
    <clear />
    <add key="" value="" protocolVersion="3" />
    <add key="github" value="****/index.json" />
        <add key="Username" value="***" />
        <add key="ClearTextPassword" value="****" />

The dotnet restore does not even take a --api-key parameter.

Guys, now we able to setup api-key directly in dotnet push command.
You can check how I use that here:

Tested 02.12.2020 - It works!

1 Like