1

I'm trying to push a Docker image to ghcr.io. But I'm stuck.

I have created an action on GitHub, that logs into ghcr.io using this code:

echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

And it passes as a successful step in my GitHub action. I see this response:

Login Succeeded

Then I try to push using this command:

docker push ghcr.io/organization_name/repository_name:latest

And my organization is private. It shows me this error:

denied: installation not allowed to Create organization package
Error: Process completed with exit code 1.

I go to ghcr.io to manually create the repository (just the way we do on Docker Hub), but it's navigation does not have a good UX, at least in my opinion. I click Get Started on their home page, and it takes me to docs page. And when I click Quick Start there, it shows a sample of publishing NPM package. There I see that you should go to your repositories container landing page but I see no link to click to navigate there or no menu item anywhere.

Also I can't find out how to create this package repository using docs

How should I proceed?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Hossein Fallah
  • 1,859
  • 2
  • 18
  • 44

1 Answers1

1

It looks like you have not granted the right permission to the token. You need to give it the write:package permission (can be changed when you open the details of your personal access token).

Sebastian P.
  • 818
  • 8
  • 20
  • 1
    The problem was not the permission. It was because I had deleted this repo and recreated it with the exact name. I had to go and manually delete the package that had been upload previously, directly from the organization packages page. Then it worked. – Hossein Fallah May 25 '22 at 05:34
  • the github token was generate automatically, how to change the permission? – Dolphin Jul 03 '23 at 20:23
  • 1
    Go to your Settings » Developer Settings » Personal Access Tokens. You see a list of all tokens and when you *edit* them, you can alter the permissions. The UI differs a bit, depending on whether you use the new fine-grained tokens or the classic tokens. – Sebastian P. Jul 10 '23 at 11:41