redhat-actions / push-to-registry

GitHub Action to push a container image to an image registry.
https://github.com/marketplace/actions/push-to-registry
MIT License
100 stars 33 forks source link

Failing to push image to ghcr.io: 403 (Forbidden) #52

Closed J3RN closed 3 years ago

J3RN commented 3 years ago

Luckily I managed to figure out this issue, but I wanted to write about it so that other could find it.

Issue

In the step using this action, I would receive the following error from Podman:

Error: trying to reuse blob sha256:b2d5eeeaba3a22b9b8aa97261957974a6bd65274ebd43e1d81d0a7b8b752b116 at destination: failed to read from destination repository my_org/my_image: 403 (Forbidden)

Solution

This was a pre-existing package that I'm simply trying to automate the workflow around. The solution lied in permissions on the package. Namely, I needed to:

  1. Navigate to the package
  2. Click "Package settings" on the right side image
  3. Add the repository running the GitHub Action in the "Manage Actions access" section image

Voila! It works now.

tetchel commented 3 years ago

Thanks, I added this to the troubleshooting.

bollian commented 2 years ago

As someone who is trying to publish a container for the first time and thus doesn't have access to the packages button in the sidebar, what am I supposed to do?

tetchel commented 2 years ago

I think in the past, I pushed my first version of an image from the command line myself, rather than having Actions do it.

There is probably a better way, though.