github-actionsghcr

ERROR: denied: installation not allowed to Create organization package


When I tried to push the github action build package into github container registry, shows error like this:

#21 pushing layer 71bf85df11bc 0.5s done
#21 pushing layer 2e8dc9c47172 0.5s done
#21 pushing layer cdd7c7392317 0.5s done
#21 ERROR: denied: installation not allowed to Create organization package
------
 > pushing ghcr.io/jiangxiaoqiang/rust-musl-builder:beta with docker:
------
ERROR: denied: installation not allowed to Create organization package
Error: buildx call failed with: ERROR: denied: installation not allowed to Create organization package

I am using personal user right now, does this only support for organization? I have tried to create a classic token but when I add the GITHUB_TOKEN the system told that this is the system environment maintained by github.

what should I do to fixed this problem? did I have to switch my project to an organization?


Solution

  • tried to add permisson configuration in the gihub workflow:

    build_and_push:
        name: Build image & push
        runs-on: ubuntu-latest
        permissions:
          contents: read
          packages: write
    

    works.