Pull image from container registry using fine-grained access token #38467
|
Hello, is it possible to pull image from ghcr.io using fine-grained personal access token? I've tried to use the token with read permissions but image pull fails with 403 Forbidden status. |
Replies: 44 comments 35 replies
|
Hi there @mkniazuk123 and welcome to our community! Thank you for asking a great question 🙂 To get started, introduce yourself in our official introduction thread |
|
Was just looking into this myself. From the docs, fine-grained tokens are not supported. |
|
I am also having this issue, seems like over the past few days PAT (classic) is now broken for NPM registry also. |
|
Is this on the road map? It's one of our main use cases for tokens and I'd love to use a finer grained token approach for this. |
|
Same here. We're looking to enforce fine-grained tokens so we can take advantage of the Enterprise management of the tokens. This will be a blocker to enforcing the removal of classic tokens. |
|
Fine-grained access token is also not working for me for accessing the Docker registry gchr.io :( This would be great once it works though |
|
Does GitHub have any plans on fixing this? I think that access token with access only to packages in specific repository is one of the most basic security features they could offer. For example GitLab allows access token generation for individual repo and I think that is much cleaner solution for deployment tokens. |
|
Any update on this @github? It seems crazy that in order to publish container images to the Github registry you must use a classic token that has full write access to the repo. |
|
Any updates on this? 🙏 |
|
So looking into this a bit more: I can understand why the devs didn't initially add package support, because packages themselves are tied to an account, or an organization, and not to a specific repository. In our cases, if a package is linked to a repo (And permissions are inherited), it should be fairly trivial to check permission from a fine-grained access token if they have access to read packages that are linked to that repository. I implore github to add functionality for fine-grained access tokens, as security is important: I don't want to give PAT tokens to my cluster which have more access than what is needed. |
|
Okay, so "repository contents" in fine-grained tokens wasn't it, and I'm never getting back the time I wasted... |
|
Hi guys, I was able to pull successfully from Github Registry using Fine-Grained token Repository permissions Can you please try again on your end and let me know how it works? Thanks, |
|
@dummy-andra Can it work for pushing? I tried to set read-write to all permissions, but actions can't push image to github registry. Got 403. |
|
Thank you to everyone that has shared how to grant "package read permission" using the fine-grained access token. With that in mind, I was reminded how the "classic" provides the precise access rights - ironic. Until there is what I would call "direct support" for providing read access to the organization's packages using the fine-grained access token, I might recommend sticking with |
|
Atleast add permission to: write:packages This is what we need |
|
For folks who have been following along, GItHub has added this into their public roadmap: github/roadmap#558 |
|
@ankneis Do you have any insight into the process behind removing it from the roadmap? This is 2026 btw :) |
|
@github - Whenever you want guys ! Nobody is waiting for you 🤣 🤯 🔫 |
|
god i hate github |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
they removed it from the public roadmap in 2024, doesn't seem they are willing to implement it 🫠 |
|
for anyone still searching for a solution, this is the only thing that reliably works: we have worked around the issue by creating a dummy github account that only has read access to this one repository and are using a token created from that user account it's ugly but the best option we have until there is communication from github on this, which I don't think there will ever be |
|
The enshitification of github continues |
Docker login to GHCR with a Personal Access Token (classic)Posting this method as found no method to use fine-grained access token. Pulling from a private GitHub Container Registry package requires authentication using Setup
echo "ghp_YOUR_TOKEN" | docker login ghcr.io -u x-access-token --password-stdin
docker pull ghcr.io/YOUR_ORG/YOUR_IMAGE:latestUsing |
|
Hi, there. Can you guide me how to do it in the right way? |
|
Our security team has disabled PAT (classic) in our organization and we lost access to all private images. Need fine-grained tokens with container registry ASAP! |
|
Having an issue with this now, having just started for a new employer, and now I'm left with the challenge of accessing all things needed for work without having to expose my personal projects. Can't believe that this is still an issue in today's world where we need to be so much more security conscious with the increasing threat levels!? |
|
alright time for Forgejo |



Was just looking into this myself. From the docs, fine-grained tokens are not supported.
https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry