GitHub Authentication Failure when Clone, Fetch, Pull and Push

Seralahthan
2 min readNov 3, 2019

--

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 following error message will be displayed when you try to do Git Clone, Git Fetch, Git Pull and commands.

Let’s see how we can resolve 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.

Originally published at https://serantechexplore.wixsite.com on November 3, 2019.

--

--

Seralahthan
Seralahthan

Written by Seralahthan

Consultant - Integration & CIAM | ATL@WSO2 | BScEng(Hons) in Computer Engineering | Interested in BigData, ML & AI

No responses yet