GitHub authentication failing over https, returning wrong email address

GitHub's support determined the root of the issue right away: Two-factor authorization.

To use GitHub over the shell with https, create an OAuth token. As the page notes, I did have to remove my username and password credentials from Keychain but with osx-keychain in place, the token is stored as the password and things work exactly as they would over https without two-factor authorization in place.


I do not have an @github.com address

You don't have to: the @ is the separator between the username:password and the domain.
It is not an email address.

A full GitHub https url would be:

# 2014:
https://username:[email protected]/username/reponame.git

# 2021+:
https://username:[email protected]/username/reponame.git

Without the token (which would then be asked on the command line), that would give:

https://[email protected]/username/reponame.git

But again, [email protected] isn't an email address, just the first part of the credentials.

Make sure the case of your username and reponame is correct: it is case-sensitive.


Since Aug. 2021, GitHub no longer accept account passwords when authenticating Git operations on GitHub.com.
Only PAT (Personal Access Token)


Note that you can store and encrypt your credentials in:

  • 2014: a .netrc.gpg (or _netrc.gpg on Windows) if you don't want to put said credentials in clear in the URL.
    See "Is there a way to skip password typing when using https://github".
  • 2021+: a credential helper called manager-core, using the Microsoft cross-platform GCM (Git Credential Manager)

  • Go to Credential Manager => Windows Manager
  • Delete everything related to tfs
  • Now click on Add a generic credential and provide the following values

    (1) Internet or network adress: git:https://tfs.donamain name (2) username: your username (3) password: your password

    this should fix it

Tags:

Git

Https

Github