Helm registry login doesn't work while trying to login to gitlab registry

Summary

Helm login to remote gitlab registry is not working

Steps to reproduce

Recently i was trying to login to my private gitlab registry using helm using my gitlab user and token, like -

helm registry login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY

But I encounter

time="2021-05-07T11:31:46+05:30" level=info msg="Error logging in to v2 endpoint, trying next endpoint: login attempt to https://registry.example.org/v2/ failed with status: 403 Forbidden"
Error: login attempt to https://registry.example.org/v2/ failed with status: 403 Forbidden
ERROR: Job failed: exit status 1
FATAL: exit status 1

I tried following this #197997 (closed) - but still it fails in the login step with the same error

But, while i try this https://helm.sh/docs/topics/registries/ - i.e pushing to my local registry it works fine.

I tried on gitlab version 13.11.2-ce.0 and My helm version is 3.5.4

Edited by aman shah