2021年8月13日之后使用git push会报下面这个错:
fatal: HttpRequestException encountered.
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
解决办法:
1. 创建 private token,参考:https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
把 private token记下来下面要用。
2. 使用git 命令重定向远程仓库地址:
即 git remote set-url origin https://[private token] @github.com/[用户名]/[仓库名]
如,原来的仓库地址是 https://github.com/zhangsan/project1.git,private token是abc,则使用指令:
git remote set-url origin https://abc@github.com/zhangsan/project1.git