When I try:
docker push ghcr.io/username/imagename:latest
as per GitHub docs, I see
unauthorised: unauthenticated: User cannot be authenticated with the token provided.
How do I push the image to ghcr?
When I try:
docker push ghcr.io/username/imagename:latest
as per GitHub docs, I see
unauthorised: unauthenticated: User cannot be authenticated with the token provided.
How do I push the image to ghcr?
You have to give docker permission to push to your GHCR (instructions are in the github docs, but are somewhat buried).
3 Steps:
Create an access token (PAT) (here) and give it read/write packages permissions.
Copy the PAT to clipboard, and run this in your terminal:
docker login ghcr.io -u username -p ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
replacing username
with your GitHub username, and ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
with the PAT you just made. Now docker has access to your GHCR, including the ability to push.
push
command again and it will work:docker push ghcr.io/username/imagename:latest