GitHub 身份验证通过 https 失败,返回错误的电子邮件地址 [英] GitHub authentication failing over https, returning wrong email address
问题描述
从命令行(通过 https,而不是 ssh)使用 GitHub 启动推送或任何其他操作,调用用户名和密码不仅会失败,而且会返回
Initiating a push or any other action with GitHub from the command line (over https, not ssh) that calls for the username and password not only fails but, when it does, it returns
Username for 'https://github.com': username
Password for 'https://username@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/username/repository.git/'
我没有 @github.com
地址.密码和用户名正确.
I do not have an @github.com
address. The password and username are correct.
我知道我可以切换到 SSH 并使用密钥,但这并不能解释为什么身份验证通过 https 失败.
I know I could switch to SSH and use keys but that doesn't answer why the authentication is failing over https.
推荐答案
GitHub 的支持立即确定了问题的根源:双因素授权.
GitHub's support determined the root of the issue right away: Two-factor authorization.
要在带有 https 的 shell 上使用 GitHub,创建一个 OAuth令牌.正如页面所指出的,我确实必须从 Keychain 中删除我的用户名和密码凭据,但是在 osx-keychain
到位后,令牌存储为密码,并且事情与通过 https 完全一样,没有两个-因素授权到位.
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.
这篇关于GitHub 身份验证通过 https 失败,返回错误的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!