远程:无效的用户名或密码。致命:身份验证失败,启用双因素身份验证后
remote: Invalid username or password. fatal: Authentication failed, after two-factor authentication enabled
启用双因素身份验证后,尝试git clone
、git fetch
等时出现以下错误:
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/smartsendio/pickup-map.git/'
启用双因素身份验证后无法使用密码访问
您需要创建个人访问令牌
现在使用访问令牌而不是密码
获得访问令牌后,您需要运行执行以下命令之一。然后,当您 运行 您的下一个 'git push' 时,它会询问您的用户名和密码,这是您的访问令牌。
MAC
git 配置 --global credential.helper osxkeychain
WINDOWS
git 配置 --global credential.helper wincred
一种解决方案是使用个人访问令牌,如@surendra 所述;另一种解决方案是使用受密码保护的 SSH 密钥:
按照此处的说明进行操作:
...但是关于使用 ssh 进行身份验证,我想说明的要点是关于 git 配置文件,.git/config
(在您的存储库中)。您可能会看到类似于以下内容的一行:
[remote "origin"]
url = https://github.com/smartsendio/pickup-map.git
fetch = +refs/heads/*:refs/remotes/origin/*
注意上面的url
行...必须改为:
url = git@github.com:smartsendio/pickup-map.git
...您可以 copy/paste 来自 GitHub 存储库代码按钮的值:
启用双因素身份验证后,尝试git clone
、git fetch
等时出现以下错误:
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/smartsendio/pickup-map.git/'
启用双因素身份验证后无法使用密码访问
您需要创建个人访问令牌
现在使用访问令牌而不是密码
获得访问令牌后,您需要运行执行以下命令之一。然后,当您 运行 您的下一个 'git push' 时,它会询问您的用户名和密码,这是您的访问令牌。
MAC git 配置 --global credential.helper osxkeychain
WINDOWS git 配置 --global credential.helper wincred
一种解决方案是使用个人访问令牌,如@surendra 所述;另一种解决方案是使用受密码保护的 SSH 密钥:
按照此处的说明进行操作:
...但是关于使用 ssh 进行身份验证,我想说明的要点是关于 git 配置文件,.git/config
(在您的存储库中)。您可能会看到类似于以下内容的一行:
[remote "origin"]
url = https://github.com/smartsendio/pickup-map.git
fetch = +refs/heads/*:refs/remotes/origin/*
注意上面的url
行...必须改为:
url = git@github.com:smartsendio/pickup-map.git
...您可以 copy/paste 来自 GitHub 存储库代码按钮的值: