Tutorial to fix “remote HTTP basic access denied” error while trying to push code changes on Gitlab.
Nothing is error-free these days. One system working fine at the moment might not work the next moment. The same goes for GitLab too as sometimes you might have fatal authentication failure errors while trying to push your code changes to your Gitlab account.
You might see an error something like this:
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/gitlab_account_username/gitlab_repository/'
Fix “remote http basic access denied” Error : GitLab “Fatal Authentication Failure” Error
It is quite easy to fix this issue as the solution is within the problem. Everything on the web is using HTTPS. GitLab repository is also using HTTPS. Gitlab is becoming more cruel and rude these days as it has started to ask you your own SSH keys to authenticate.
Don’t worry if you find it complex as we will help you with the whole process. First check if you already have SSH keys or not with the following command:
ls ~/.ssh/id_rsa.pub
If you don’t have your own SSH keys, you can create them using the following process:
Open a terminal run the following command at first:
ssh-keygen
There will be output something like below and follow the onscreen instruction and press the enter key and go with the default choice. You might have a password for your SSH key.
Generating public/private rsa key pair.
Enter file in which to save the key (/user_home/.ssh/id_rsa):
Copy the content of your public key from the file cat ~/.ssh/id_rsa.pub
. You need to paste the content of your public key by logging in to your GitLab account, go to User Settings, and clicking on SSH keys in the left sidebar. Then you need to paste the public key there and hit the Add key button.
Now, you can easily push your code changes to the Gitlab account.
Let us know if this works for you and also share with us more ideas to solve this error.