由于电子邮件验证,无法推送到github

时间:2020-02-25 17:18:08

标签: git github

我无法推送到github的新存储库,终端提示此消息:

ERROR: You must verify your email address.
See https://github.com/settings/emails.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

电子邮件已在github的该部分进行了验证,并且此命令返回的结果相同:

git config user.email
git config --global user.email

2 个答案:

答案 0 :(得分:2)

另一个选择:检查您的git config credential.helper输出

如果帮助程序缓存了错误的凭据,它将使用错误的帐户(电子邮件仍未经验证)。
强制它再次询问您说的凭据(如“ How do I sign out in the Git Bash console?”中所述)

git credential-manager reject https://github.com

下一次推送将迫使您输入正确的帐户/密码,这将通过电子邮件验证步骤,因为您提到该帐户已经已经验证了其电子邮件。

在Mac(osxkeychain)上,使用git credential-osxkeychain erase command

printf 'host=github.com\nprotocol=https\n\n' | git credential-osxkeychain erase

但是,如果您的URL已经 一个SSH协议(git@github.comssh://git@github.com)...那么凭据助手将无关紧要。

“将其更改为URL”(可能是HTTPS)并使其起作用,意味着已缓存 right 凭据(对于HTTPS github.com URL)。

另一种选择是重命名/保存~/.ssh/id_rsa(.pub)文件和regenerate SSH keys, associating them with the right account(带有已验证电子邮件的文件)。
这样就不需要更改URL。

答案 1 :(得分:0)

以某种方式,SSH链接给我带来了麻烦,但是我将其更改为URL,然后它开始工作。