-
I’m using the standard template (https://github.com/actions/starter-workflows/blob/master/ci/gem-push.yml) for publishing a Ruby gem to the package registry. I commented out the part of publishing to RubyGems, since this gem is private for now. After successfully publishing the gem, I am unable to install it locally. The error I’m getting is a 401 after copying the install command from the packages page.
Some notes: The repository ‘my_gem’ is a private repo I mantain. The OWNER environment variable in the action is jer-k The GPR_AUTH_TOKEN environment variable has package:write package:read repo permissions. I added the same token to my .gem/credentials following the instructions from https://help.github.com/en/articles/configuring-rubygems-for-use-with-github-package-registry#authenticating-to-github-package-registry I’m must be missing something about how to authenticate. I was also trying to search how to distinguish between publishing public and private packages (this is a feature the package registry talks about) but I couldn’t find anything to indicate how to do it; maybe that is based on whether or not the repository is private? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
Sorry to hear that. Just to clarify a few things: you’re using the same GPR_AUTH_TOKEN that you set up as a secret in your Actions workflow? When you created the file, did you use a text editor? Are you on Windows? (That may change the line endings). If you open bash (Git Bash if you’re on Windows) and run:
Is there any change in behavior? |
Beta Was this translation helpful? Give feedback.
-
Yes, I’m using the same token in the action and the command line. I’m on OSX and I had set it up through vim originally. I just used that command and the result was the same. |
Beta Was this translation helpful? Give feedback.
-
Having the same issue (Linux). ~/.gem/credentials is configured properly. The same token works with bundler on the same machine, but |
Beta Was this translation helpful? Give feedback.
-
Also having the same issue, but only for some gems. Bundle install / update simply refuses to find a gem which is clearly published to Github Packages. Downloading the binary of the gem into vendor cache resolves the issue, but that is definitely a suboptimal solution. We’ve transitioned from Gemfury to Github Packages, and I’ve seen had an issue like this occur on Gemfury. Very confusing. |
Beta Was this translation helpful? Give feedback.
-
We’ve given up on Github Packages now and gone back to Gemfury. I think this one needs a bit more baking before it’s ready. We’re super keen to come back and use it once it’s done. |
Beta Was this translation helpful? Give feedback.
-
I believe I had the same issue as the original post, in that the command line given by github to install the gem gave that error. As far as I can tell, gem install does not use the credentials file. But the command worked when I changed the github URL to include user name and token, as per basic authentication. –source “https://{username}:{token}@rubygems.pkg.github.com/…” |
Beta Was this translation helpful? Give feedback.
-
Finally circled back to this and I’m accepting this as the solution. It is not optimal, but it works for now! Also just don’t forget to remove the |
Beta Was this translation helpful? Give feedback.
-
Thanks for this. I’ve filed a feature request with RubyGems to have all commands support stored credentials consistently. |
Beta Was this translation helpful? Give feedback.
I believe I had the same issue as the original post, in that the command line given by github to install the gem gave that error. As far as I can tell, gem install does not use the credentials file. But the command worked when I changed the github URL to include user name and token, as per basic authentication.
–source “https://{username}:{token}@rubygems.pkg.github.com/…”