我生成了一个新的访问 token ,并尝试克隆一个存储库,但收到了该错误:
Github remote: Invalid username or password. fatal: Authentication failed
我尝试了多次试验,我将github token设置为:
git config --global github.token mytoken
我打开 .gitconfig 文件进行检查并发现它正确:
[user]
name = {github user}
email = {github email}
[github]
token = {new token}
[credential]
helper = store
[core]
editor = vim
我什至尝试过git config --global --unset-all user.password
我期望它会询问我的用户名和密码(在这种情况下,我会添加 token ),但它既没有询问用户名也没有密码,并且当我尝试克隆时仍然遇到相同的错误。
有什么我遗漏的东西可以帮助或者我需要检查什么吗?
最佳答案
Git 存在配置重复问题,请尝试使用以下命令将所有配置替换为新 token :
git config --global --replace-all remote.origin.url https://<username>:<token>@github.com/<username>/<repo_name>.git
关于Github远程: Invalid username or password.致命:身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71600196/