Hello guys, welcome to my web development blog Webcrop. Today in this article i am going to show you step by step how to easily fix this "Fatal: Authentication Failed" error in git in very simple steps.
This "Fatal: Authentication Failed" error usually occurs when you are trying to push your local repository to remote repository on GitHub via (CLI) Command Line Interface. Or when you have enabled (2FA) Two Factor Authentication on your GitHub account.
Most common cause of this error is when you execute "git push -u origin master" command in your terminal. What this command does is it basically links your remote repository to your local repository.
Now without wasting time let's dive in to solve this issue.
How to solve "Fatal: Authentication Failed" error in git, GitHub, version control.
Follow Below Steps carefully solve this issue
Step 2: Login to your GitHub account.
Step 8: After clicking the Generate new token button you will see many input fields as shown in image below.
There is no need to worry about the warning. You can clearly read that warning. So you can go on wih no Expiration option.
Related: Complete Beginner’s Guide to become a job ready full stack web developer.
After filling Expiration input field. Now you need to check out the checkboxes. You can select them according to your needs but i suggest you to select all of them if you are newbie to Git, GitHub and Version Control but if you know this stuff then you can select checkboxes according to your need. In the picture below i have also selected all the checkboxes.
Step 9: After filling all the necessary input fields. You will see a green colored "Generate Token" button. Click on that button.
Step 10: After clicking the Generate token button. You will see your token is generated in a green colored wide box as shown in image below. Now on the right side of access token you will see a copy icon. Click to copy the access token.
Note that this token is only shown one time to you, so make sure to copy it and paste it in a text file and save that. So in future you will not face the same problem.
After copying the access token, now let's try to push a local repository to remote repository and see if this "Fatal: Authentication Failed" error is gone.
Step 11: Open the terminal and execute the following command "git push -u origin master" now it will ask uou for username write your GitHub username there and hit enter after hitting enter it will ask you for password now in the password you have to paste your personal access token which you generated previously.
Now this error "Fatal: Authentication Failed" should be gone. If not i am providing the below link to a Stack-overflow page where this issue is also discussed and answered.
