Unable pushing NuGet package to GitHub Packages with "The expected resource was not found."

I’m trying to push the NuGet package to GitHub Packages in mine, but I can’t push them.

I’ve downloaded NuGet package helloworld.1.3.0.15.nupkg from nuget.org for testing.

With nuget.exe;

>nuget.exe push helloworld.1.3.0.15.nupkg -Source "GitHub"
Pushing helloworld.1.3.0.15.nupkg to 'https://nuget.pkg.github.com/haeillee'...
  PUT https://nuget.pkg.github.com/haeillee/
WARNING: The expected resource was not found.
  NotFound https://nuget.pkg.github.com/haeillee/ 847ms
Response status code does not indicate success: 404 (Not Found).

With curl;

$ curl -vX PUT -u "haeillee:GITHUB_TOKEN" -F package=@helloworld.1.3.0.15.nupkg https://nuget.pkg.github.com/haeillee/
* STATE: INIT => CONNECT handle 0x29919b0; line 1392 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* STATE: CONNECT => WAITRESOLVE handle 0x29919b0; line 1428 (connection #0)
* Trying 52.79.52.209...
* TCP_NODELAY set
* STATE: WAITRESOLVE => WAITCONNECT handle 0x29919b0; line 1509 (connection #0)
* Connected to nuget.pkg.github.com (52.79.52.209) port 443 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x29919b0; line 1561 (connection #0)
* Marked for [keep alive]: HTTP default
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* STATE: SENDPROTOCONNECT => PROTOCONNECT handle 0x29919b0; line 1575 (connection #0)
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.pkg.github.com
* start date: Apr 26 00:00:00 2019 GMT
* expire date: Apr 30 12:00:00 2020 GMT
* subjectAltName: host "nuget.pkg.github.com" matched cert's "*.pkg.github.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
* SSL certificate verify ok.
* STATE: PROTOCONNECT => DO handle 0x29919b0; line 1596 (connection #0)
* Server auth using Basic with user 'haeillee'
> PUT /haeillee/ HTTP/1.1
> Host: nuget.pkg.github.com
> Authorization: Basic aGFlaWxsZWU6NjE1YmFhMGFkMmQ3Njg5YTYzMTM4MmM0MTAzOGU5ZDllMDU0NjllYg==
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Length: 17677
> Content-Type: multipart/form-data; boundary=------------------------a0e5cb38319d14d0
> Expect: 100-continue
>
* STATE: DO => DO_DONE handle 0x29919b0; line 1658 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x29919b0; line 1783 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x29919b0; line 1799 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 100 Continue
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 404 Not Found
< Date: Wed, 04 Dec 2019 11:09:01 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 49
< Content-Security-Policy: default-src 'none';
* Server GitHub Registry is not blacklisted
< Server: GitHub Registry
< Strict-Transport-Security: max-age=31536000;
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-Nuget-Warning: The expected resource was not found.
< X-Xss-Protection: 1; mode=block
< X-GitHub-Request-Id: FF85:2181:1B842:32EF4:5DE793CC
* HTTP error before end of send, stop sending
* Marked for [closure]: Stop sending data before everything sent
<
{"error":"The expected resource was not found."}
* STATE: PERFORM => DONE handle 0x29919b0; line 1968 (connection #0)
* multi_done
* Closing connection 0
* The cache now contains 0 members
* TLSv1.2 (OUT), TLS alert, Client hello (1):

The same error has been founded.

Absolutely, I’ve set all configurations for this (Personal access tokens, apikeys, …).

Should I wait until GitHub Package become stable?

1 Like

I’m also getting the same error, Response status code does not indicate success : 404 (Not Found)

and stuck with this issue now.

1 Like

Your repository must have the same name as your nuget package.

<repository_name>.<version>.nupkg

That’s worked for me using curl.

2 Likes

I have the same error

1 Like

@maordavidzon

Sorry, I’ve tried but got same error… :frowning:

Same here, with Curl, with same name of the package as that of the repo, or with nuget cli.

Followed this guide https://help.github.com/en/github/managing-packages-with-github-packages/configuring-dotnet-cli-for-use-with-github-packages and ended up having the same issue.

+1 with the same error after following this guide https://help.github.com/en/github/managing-packages-with-github-packages/configuring-dotnet-cli-for-use-with-github-packages 

.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100/

Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db

I’m in the same boat. Anyone was able to sort this one out?

It turns out my github personal access token was missing repo permissions. Having write:packages, read:packages and delete:packages permissions wasn’t enough.

4 Likes

Make sure you correctly specified repository url, as in

<RepositoryUrl>https://github.com/user-name/repo-name</RepositoryUrl>
1 Like

I got this working by adding this to my nuspec file

<repository type="git" url="https://github.com/user-name/repo-name" />
2 Likes

You can also specify it on the command line (dotnet or MSBuild) using -p:RepositoryUrl=

1 Like

I have a token with full access to the repo and the package registry and I’m still getting the same error. By the way, I’m trying to publish a RubyGem, not a Nuget package. It seems that this bug is all over. 

Hitting the same issue when publishing a .NetCore2.1 library from Windows command line.

C:\TestProject>nuget push source\TestProject.Core.Domain\bin\Release\TestProject.Core.Domain.1.0.0.1.nupkg -Source "github"
WARNING: No API Key was provided and no API Key could be found for 'https://nuget.pkg.github.com/ABCCorp'. To save an API Key for a source use the 'setApiKey' command.
Pushing TestProject.Core.Domain.1.0.0.494-alpha.nupkg to 'https://nuget.pkg.github.com/ABCCorp'...
  PUT https://nuget.pkg.github.com/ABCCorp/
WARNING: The expected resource was not found.
  NotFound https://nuget.pkg.github.com/ABCCorp/ 1820ms
Response status code does not indicate success: 404 (Not Found).

Have followed advice in every post/example I can find.

Using a Personal Access Token with repo, write:packages, read:packages and delete:packages scope.

Have tried using a nuget.config file, and adding source on command line.

Project file specifies the RepositoryURL, PackageId, RepositoryType, Company, Version etc.

Really can’t see why this wouldn’t work.

I found a fix for this, I triple checked I had all my names set correct per the GitHub documentation and nothing worked…finally I decided to pull dotnet out of the equation and just a nuget push…voila, it worked like a champ! Try your push command without the dotnet prefix…

Were you able to resolve this? I’m having the same problem attempting to push a ruby gem

I have the same error. But, I integrate some APIs of google in my account. You can read here to documents.

1 Like

My fix for this was to add the entire tree of repo properties to the personal access token (also mentioned above in this thread).

My key was failing before and worked after this single change.

I then recalled that I had created an access token for this purpose before … in reviewing it, the permissions of that key included the the repo tree of permissions.