I'm using Gitlab package registry and what worked for me was generating a new personal access token with read/write scopes to the registry.
I assume it might be the same for Github.