Unable to push RubyGem to Package Registry (The expected resource was not found)

I’ve been able to push gems before but now for some reason I’m unable to? However, it was on my personal account and now I’m trying on an org account.

I have my credentails stored and saved

$ cat ~/.gem/credentials

:rubygems_api_key: [key]
:github: Bearer [key]

But when I go to push it, using the following command:

gem push --key github --host [https://rubygems.pkg.github.com/ORG] [REPO]-0.1.0.gem

It fails, with this error:

Pushing gem to https://rubygems.pkg.github.com/x
The expected resource was not found.

What should I do? I’ve already made sure to select way more scopes than I probably need

 At first I thought it might be the dashes in the repo name, however the previous push (that worked) has dashes. 

I’m out of ideas, what’s the situation here? We’re dealing with a 404 here, not a 401, so the error must have to do with some naming convention.

2 Likes

Did you ever figure this out? I’m having the exact same issue, things work fine for a personal repo but I get the same error trying to publish to an org repo.

1 Like

Same here - It works for one of our org-private projects (and with org-private packages), but with the same config, it fails for another.

Using an issuficient token raises a different error, so I suppose my token is ok.

Solved it with the help of the GH support. or me, it was the gem name in the spec - it has to match the name of the repository within your organisazion.

So, for a repo

great-org/foobar-baz

, the gem needs to have the name

‘foobar-baz’

. Otherwise, GH packages seems to be unable to link back to your repo, giving you the somewhat misleading error message.

5 Likes

I had the same problem and + 1. For me the problem was an underscore in the repo name. As long the repo name was “ve_core” the push didn’t worked for me. After I renamed it to “ve-core” it worked fine. 

this is truly annoying.
I can’t possibly rename all my gems because I want to host them on Github

that’s a huge fail
I need to push my gems as-is.