GitHub认证通过https失败,返回错误的电子邮件地址 [英] GitHub authentication failing over https, returning wrong email address
问题描述
使用GitHub从命令行(通过https,而不是ssh)启动推送或任何其他操作,调用用户名和密码不仅失败,而且当它返回时,它返回
'https://github.com'的用户名:username
'https://username@github.com'的密码:
远程:无效的用户名或密码。
致命:'https://github.com/username/repository.git/'
认证失败
我没有 @ github.com
地址。密码和用户名都是正确的。
我知道我可以切换到SSH并使用密钥,但这并不能解释为什么验证通过https失败。
GitHub的支持立即确定了问题的根源:双因素授权。
要通过https在shell上使用GitHub,请创建OAuth令牌。正如页面所示,我确实必须从Keychain中删除我的用户名和密码凭证,但使用 osx-keychain
就位,令牌存储为密码,事情的工作方式与他们会在没有双重授权的情况下通过https。
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/'
I do not have an @github.com
address. The password and username are correct.
I know I could switch to SSH and use keys but that doesn't answer why the authentication is failing over https.
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.
这篇关于GitHub认证通过https失败,返回错误的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!