Fail to push/pull images with denied message

I want to push a docker image to the packages but I get this error.

root@srv159894 ~$ docker push ghcr.io/miladrahimi/php:8.1.6-fpm-bullseye
The push refers to repository [ghcr.io/miladrahimi/php]
42bcbddc86c3: Preparing
ca1cb0224942: Preparing
f2f8aaa19d03: Preparing
545ecec6e3d9: Preparing
358201af6284: Preparing
f463733a4d61: Waiting
f5cf072b7fe0: Waiting
156a40af189d: Waiting
2543fd1f256d: Waiting
fd95118eade9: Waiting
denied: denied

It happend because my token was expired.

Hi @miladrahimi ,

Thanks for updating the discussion and we’re glad that you figured that the issue occurred since your token got expired.

But dear @Akash1134, it should considered by Github. When your token is invalid or not set it displays a helpful message “denied: authentication error” but when it’s expired, it only displays “denied: denied” which is not helpful at all.