Git – How to Solve “remote: Invalid username or password. fatal: Authentication failed”
This article focuses on discussing how to solve git error (remote: Invalid username or password / fatal: Authentication failed). The approach will be to create a dummy example project file and upload it to the Git Repository properly without the following error.
Prerequisites: Git Repository, GitBash, Git Clone
Step By Step Solution
Step 1: Creating git repository and installing GitBash
You will first create a git repository where you will be pushing all your project files. And for that, you need to be installed with GitBash too (How to Install Gitbash and How to Work and Push Code on Git Repository?)
Once you are familiar with the above things, you can now move ahead with the article which will be focusing on the git error (remote: Invalid username or password / fatal: Authentication failed).
Step 2: For demonstration purposes, we have created a dummy git repository that looks something like the image attached below.
Following image attached below shows the files which we are gonna upload to the GitHub repository.
Step 3: Checking whether GitBash has been installed on our machine successfully or not.
Step 4: Once Steps 2 and 3 is been done
If while doing step 2 i.e. following the quick setup tutorial or the article which is attached in step 1 on how git works, if you are prompted with the error (remote: Invalid username or password / fatal: Authentication failed) i.e. as shown in the image attached below. Then this article is gonna focus on that error only.
Step 5: Solve the error
A) Go to settings in your Github account >> Developer settings >> Personal access token >> Tokens (classic) >> Generate new token. See the images attached below for a better understanding.
For generating tokens you can follow up on this article (How to Create GitHub Personal Access Token).
B) Once you are ready with the token go again to your GitBash terminal and execute the push command. You will be redirected to a popup as shown in the image below:
C) Next, here in the pop-up tab you can:
- Simply copy and paste the token which you have generated just now.
- Or, you can go ahead and click on Sign in with your browser.
Once that is done you have finally reached your destination, you will be redirected to a new page saying, see the image below.
Once this is done close the tab and go to GitBash again and you will see the error is been solved and all the files must be uploaded successfully.
You can also visit the GitHub repository and see your files have been uploaded successfully without the error (remote: Invalid username or password / fatal: Authentication failed).
In this way, you can add your Project files to the GitHub repository without the git error i.e. (remote: Invalid username or password / fatal: Authentication failed).
Please Login to comment...