git无法clone仓库代码,HTTP Basic: Access denied fatal: Authentication failed for。。

2,981 阅读1分钟

报错内容:

HTTP Basic: Access denied fatal: Authentication failed for。。(访问被拒绝,身份验证失败)

错误原因

安装小乌龟时输入的用户和邮箱和本地Git bash的用户和邮箱不一致,且可能输错密码,导致无法clone仓库代码

尝试过的解决方法:

git config --system --unset credential.helper
git config --global user.name "XX"
git config --global user.email "XX@example.com"

重新配置Git的用户和邮箱,没有解决问题,依然报错

最后解决方法

凭据管理器
打开凭据管理器 - Windows凭据,找到对应的凭据,删除掉,重新clone,就会弹框 提示用户名和密码。原来登录凭据已被Windows记录,得在本地找到这里清除历史,再重新clone,重新输用户名密码登录远程库。