-
Hi, following the documentation at Publishing Docker images - GitHub Docs I have set up an action for a private (team) respository
Team and Repository settings have Action permissions set to “Allow all actions” and Workflow permissions are set to “Read and write permissions”. Running the job doesnt allow pushing to the container registry:
The repository / tag is already present at the time of the job execution. pushing the same tag using PAT authentication (local dev environment) does work. I have seen a couple of older articles either mentioning no support for GITHUB_TOKEN auth and image pushes and issues with pushing to non-existent repositories. I take it these are not relevant anymore as the official documentation states otherwise. Migrating to PAT based authentication is an option I am hesitant to choose as it will expose wider access to other repository based on a users’s PAT token. Am I missing something here? |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 9 replies
-
have the same issue, and do not understand why |
Beta Was this translation helpful? Give feedback.
-
Hi @pulsar256, I had the same problem as you. Googling this error I found this comment telling that using PAT is the correct way. Reading another docs, I found this steps to give GITHUB_TOKEN the write_package permission, but I couldn’t do it. |
Beta Was this translation helpful? Give feedback.
-
The Information asking to use the PAT token is outdated. I managed to get it working. It seems there are mulitple ways how GH will create a package. Depending on which path you take It seems to assign different set of “Action Permissions” to the packge/docker repository when it gets implicitly crated by the first push. This implicit creation of the package/docker repository can be triggered by a manual/remote (PAT) based initial push or by GH Actions using the configured authentication. Results seem to differ. So to fix this, head over to $yourOrganization → Packages → $yourPackage → Package settings (to the right / bottom) And configure “Manage Actions access” section to allow the git repository in question write permissions on this package/docker repository |
Beta Was this translation helpful? Give feedback.
-
Hrm… This doesn’t work if you haven’t pushed before. These steps work if you have pushed at least once. |
Beta Was this translation helpful? Give feedback.
-
I was experiencing this because I somehow ended up with a package having the name "REPO/name" unconnected to REPO (probably pushing from CLI or during repository renaming, not sure.) When I looked at my repository the package was not even showing up (but I could push from the command line). In the global packages tab (https://github.com/OWNER?tab=packages) I finally found it. I then was able to connect it to my repo, which caused the name to change from "REPO/name" to name now listed under "REPO". Next I went to my repo, saw the package, and could go to settings to enable write permissions (following steps in accepted answer). |
Beta Was this translation helpful? Give feedback.
-
I've been having the same problem, but it's intermittent. I've been playing with cdktf to create repos and set up the workflow pipelines. I've noticed that, even though the workflow file itself was always the same, sometimes the workflows could push just fine, and other times it couldn't. This is regardless of how many times I toggled the Actions write permission or recreated the repo. The inconsistency is what's frustrating me. I need to be able to rely on this workflow to always work, or it's useless. I kinda wonder if, in the process of creating, deleting, and recreating the same repo with the same name, GitHub occasionally gets confused and thinks I'm pushing to a different (older) repository. |
Beta Was this translation helpful? Give feedback.
-
I have had the same issue as @nfcopier. I am pushing to ghcr.io in my GitHub action, and my docker push fails with:
This was with the GITHUB_TOKEN having write permissions enabled. This was in a repo that had been deleted and remade with the same name. As soon as I renamed the repo, the Action successfully pushed the image to ghcr (no changes to repo settings). |
Beta Was this translation helpful? Give feedback.
-
For me, when pushing an image for the first time, I get a 403. Re-running the Docker build/push step again is successful. I have to do this for every new image I push! |
Beta Was this translation helpful? Give feedback.
-
I am facing the same issue |
Beta Was this translation helpful? Give feedback.
-
Same issue. In my case I pushed manually before ever setting up my actions YAML and that may have broke it. Packages do not show up in the list even though i successfully pushed and pulled. |
Beta Was this translation helpful? Give feedback.
The Information asking to use the PAT token is outdated. I managed to get it working.
It seems there are mulitple ways how GH will create a package. Depending on which path you take It seems to assign different set of “Action Permissions” to the packge/docker repository when it gets implicitly crated by the first push. This implicit creation of the package/docker repository can be triggered by a manual/remote (PAT) based initial push or by GH Actions using the configured authentication. Results seem to differ.
So to fix this, head over to $yourOrganization → Packages → $yourPackage → Package settings (to the right / bottom)
And configure “Manage Actions access” section to allow the git re…