Github package registry not compatible with dotnet nuget client

All instructions followed. Attempting to run a “dotnet nuget push”.

warn : No API Key was provided and no API Key could be found for ‘https://nuget.pkg.github.com/ORGANIZATION’. To save an API Key for a source use the ‘setApiKey’ command.

info : Pushing PACKAGE.nupkg to ‘https://nuget.pkg.github.com/ORGANIZATION’…

info :   PUT https://nuget.pkg.github.com/ORGANIZATION/

info : An error was encountered when fetching ‘PUT https://nuget.pkg.github.com/ORGANIZATION/’. The request will now be retried.

info : An error occurred while sending the request.

info :   The response ended prematurely.

11 Likes

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 https://github.blog/changelog for updates.

1 Like

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

4 Likes

There is a workaround using curl here https://github.com/NuGet/Home/issues/8580#issuecomment-555696372, at least until GitHub fixes problem of not allowing the apiToken to work directly using the nuget push command.

2 Likes

@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.

2 Likes

@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: https://gist.github.com/Mattamorphic/4e2ff8f62f8e2bc7f04f9d2a91bc722d

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>.

3 Likes

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?

DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0

There is something very odd going on!

1 Like

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:).

2 Likes

: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"
2 Likes

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"?>
<configuration>
  <packageSources>
    <clear />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="github" value="https://nuget.pkg.github.com/****/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <github>
        <add key="Username" value="***" />
        <add key="ClearTextPassword" value="****" />
      </github>
  </packageSourceCredentials>
</configuration>

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