2

启用双因素身份验证后,尝试 , 等时出现以下git clone错误git fetch

remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/smartsendio/pickup-map.git/'
4

3 回答 3

8

启用两因素认证后无法使用密码访问

您需要创建个人访问令牌 现在使用访问令牌而不是密码 在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

于 2017-07-20T08:32:58.170 回答
4

获取访问令牌后,您需要运行以下命令之一。然后,当您运行下一个“git push”时,它会询问您的用户名和密码,这是您的访问令牌。

MAC git config --global credential.helper osxkeychain

WINDOWS git config --global credential.helper wincred

于 2018-08-22T18:11:39.563 回答
0

一种解决方案是使用个人访问令牌,如@surendra 所述;另一种解决方案是使用受密码保护的 SSH 密钥

请按照此处的说明进行操作:

https://docs.github.com/en/enterprise-server@2.19/github/authenticating-to-github/connecting-to-github-with-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

...您可以从 GitHub 存储库的代码按钮中复制/粘贴值:

在此处输入图像描述

于 2020-11-16T20:24:15.890 回答