Classic token sunset | How to pull private npm packages from ghcr.io #177617
Replies: 3 comments 3 replies
-
|
Fine-grained personal access tokens (PATs) can be used for npm and Docker (ghcr.io), but there are a few key details that often trip people up:
For npm packages: The token needs read packages permission for the repository that contains the package. If the repository is private, you also need repository access for that repository. Double-check that the token has the correct scopes for Actions if your install runs in a workflow. For Docker images: The token needs read:packages to pull and write:packages to push. Repository access is required for private images.
For npm, your .npmrc should look like: @your-org:registry=https://npm.pkg.github.com For Docker: echo $TOKEN | docker login ghcr.io -u USERNAME --password-stdin Even if the token works in the gh CLI, npm and Docker enforce the fine-grained permissions separately, so a mismatch can prevent installs or pulls.
Using a token without proper repository access. Fine-grained tokens are repository-specific. Old credentials cached in ~/.npmrc or Docker config. Clear them before testing. Not matching the registry URL exactly (e.g., scoped packages require @org:registry=…). Summary: |
Beta Was this translation helpful? Give feedback.
-
|
I've read the article again and it seems like the sunset is for the npm classic tokens, not the gh classic tokens? |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
With the upcoming sunset of classic tokens I am curious how to make fine grained tokens work.
I tried almost every permission but fail to pull npm packages from ghcr.io in my own organization.
The
gh cliis working fine with them.npm installis not. I switched the token in the.npmrcfrom the classic token to the new fine grained tokenhttps://github.blog/changelog/2025-09-29-strengthening-npm-security-important-changes-to-authentication-and-token-management/#looking-ahead-trusted-publishers
This also does not work for docker images, so I guess it is a packages "issue" with these kind of tokens.
Beta Was this translation helpful? Give feedback.
All reactions