Git – remote: HTTP Basic: Access denied fatal: Authentication failed

gitgithubgitlabgitlab-ci

I am using git-lab.
I am facing an error while using git pull/push/clone command:

remote: HTTP Basic: Access denied fatal: Authentication failed for
'https://gitlab.com/myname/myproject'

I am facing this problem after git config --global --unset credential.helper.

Can anyone help me to come out of this problem?

Do I need to do any proxy settings? (is this firewall related issue?)

I am struct and I am not able to get working solution for this.

Best Answer

I tried many solutions listed in other similar questions , including the one mentioned above but it did not work me. what did work for me is the below way.

  • Go to your project directory and find for .git folder which will hidden by default.
  • Enter that and find for a config file and open with text editor and make changes to its token in the URL key something like below

[remote "origin"]

url = https://gitlab-ci-token:<token>@<repository-URL> 

In my case the token had expired which one can easily generate in the settings -> Access token->Create a token.

Copy paste this token to your config file in .git folder and Restart your IDE for changes to reflect.

Hope this helps!!!