top of page
Search
Tech Explore

GitHub Authentication Failure when Clone, Fetch, Pull and Push



Have you ever came across this strange behaviour that even with the correct credentials you are not able to Authenticate to your GitHub account from Bash Terminal???


The follow error message will be displayed when you try to do Git Clone, Git Fetch, Git Pull and Git Push commands.

Let's see how we can debug this issue.

  1. Check and verify whether the Git Username and Password you are using are correct.(You can verify this by, directly trying to Login to the https://github.com with the credentials)

  2. If you can directly login to the Github with the username and password, the issue might be mostly with Two Factor Authentication (2FA).

  3. Check whether the 2FA authentication is enabled in Github. Navigate to Settings -> Security section. Check whether the Two-factor authentication is Enabled


If the Two-factor authentication is enabled as above then we need to generate a new Personal Access Token to authenticate to GitHub from the Bash.


Why is this happening???

According to the Github documentation after enabling the 2FA this is the expected way of accessing the Github from command line using HTTPS.

Please refer to the Github documentation


Generating a new Personal Access Token


Navigate to Settings -> Developer settings -> Personal access tokens section and click on Generate new token.


Provide the required Permissions and create the access token.

Copy this access token and Save it for future use.


Now when trying to Authenticate with Git from the Bash, provide the Personal Access Token generated instead of the Password.


This would let you successfully authenticate to GitHub and perform Clone, Fetch, Pull and Push operations.


Thank you for reading!!!

Please feel free to leave your comments for improvement.


1,969 views0 comments

Comments


Post: Blog2_Post
bottom of page