Hero-oo

Hero-oo

email

[Problem Solving] GitHub Docker Build Error Unexpected Status from POST Request to https://ghcr.io/xx 403 Forbidden Solution

Today, when using GitHub Actions to automatically build Docker, the push failed with the error: ERROR: failed to solve: failed to push ghcr.io/xx:latest: unexpected status from POST request to https://ghcr.io/v2/xx/blobs/uploads/: 403 Forbidden.

403 forbidden

After some investigation, here are the possible reasons and solutions.

〇 Reason#

This issue occurred because the packages did not have action permissions for the repository. In my case, it was due to a previously deleted repository with the same name. This repository had already built a package, but after deletion, the package automatically lost its permissions. As a result, the new repository lacked permissions.

After Googling, I found an issue that raised a similar problem, and someone provided an answer, emmm, but did not provide an entry point:

Original answer

二 Solution#

  1. Click on the repository's packages

1

2

  1. Select packages according to Docker configuration and open package settings

1

2

  1. Add repository actions in permissions and grant write permissions

1

2

  1. Rebuild it

Done!

This article was synchronized and updated to xLog by Mix Space. The original link is https://www.vikifish.com/posts/env/github-docker-build-403

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.