I had the same problem. You need to get a personal access token and you need to add it to the registry url via the “private_token” parameter. Like this:
yeah. it’s not right… it’s for reading only. According to personal tokens read_registry
Grants read-only access to container registry images on private projects.
If you want to write (push):
use something like this in your .gitlab-ci.yml
Found this while trying to login with 2FA enabled, and had a devil of a time figuring out how gitlab wanted me to present credentials. Eventually I had to login using this presentation: