场景一
使用git
的http
协议去clone仓库的代码时,第一次弹框提示输入账号密码的时候输错了!
然后后面就一直拒绝,不再重复提示输入账号密码,怎么破?
(PS: 这里全局设置了记住密码,只会在第一次使用账号时才会弹窗让输入密码,以后直接从缓存中取,就不会再弹窗了)
git报错信息
解决方案
# 运行一下命令缓存输入的用户名和密码
git config --global credential.helper wincred
# 清除掉缓存在git中的用户名和密码
git credential-manager uninstall
场景二
git clone时遇到类似这种错误
remote: Repository not found.
fatal: repository 'https://github.com/pete/first_app.git/' not found
原因分析
一般使用http/https
协议clone
代码时,都会弹窗让输入用户名和密码。
但是如果你之前在git配置账号缓存,credential.helper=store
它会先去从缓存中获取用户身份信息。
这里假设你缓存中的用户信息是github
的账号,而你本次是从gitee
上拉取代码,这显然这是行不通的。
解决方案
- 清除缓存中的用户信息
- 使用具有权限的账号密码 git clone http://username:[email protected]/xxx/xxx.git