Push上传代码至GitHub时出现以下错误:
1. remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
(这个提示大致意思是:2021年8月13日起github将不再支持密码验证的方式Push,请将密码换成token令牌进行访问)
2. The requested URL returned error: 403
3. git did not exit cleanly (exit code 128)
如图:
题外话:
我先是将GitHub的代码仓库克隆到本地时出现了OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054的错误提示
解决办法是输入如下命令:
git config http.sslVerify "false"
如果提示:
fatal: not in a git directory
那就先执行
git init
再输入:
git config http.sslVerify "false"
然后再重新git clone,就成功了
正题内容
push上传时出现错误:
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead;
The requested URL returned error: 403;
git did not exit cleanly (exit code 128).
从我的解决过程来看,应该是第一个问题的出现引起后面两个问题,第一个问解决了后俩问题便会迎刃而解
解决方法:
1. 先创建token令牌,创建步骤可以参考官方的文档
链接:Creating a personal access token
2. 令牌创建好之后,接着打开git
输入命令清除缓存
git credential-manager uninstall
PS: 第二步如果是MAC用户,直接在钥keychain匙串里修改github 的密码为刚刚获得的token,具体操作参考文档
链接:Updating credentials from the macOS Keychain Win用户的Windows 凭据要修改的话,只需要 按下win键 输入“凭据”,即可打开Windows凭据,再找到普通凭据下GitHub的凭据进行修改(本人没用到这步,直接到第3步了),参考链接:git密码修改问题解决方案(Window &Mac)
3. 重新push,输入自己的用户名和刚刚创建的token令牌,最后成功上传。
如图:
总结:
从解决过程来看,可以大胆推测第二第三个问题是由第一个问题引起的,因此第一个问题解决后便成功push。主要还是因为GitHub从2021年8月13日开始便不再支持密码验证身份导致的,