现象
$ git push
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.
fatal: Authentication failed for 'xxxxx'
解决办法
1.将本地id_rsa.pub
拷贝到 github 的 SSH keys 中
打开github,点击右上角头像,弹出列表,点击“Settings”,点击左侧栏目上的“SSH and GPG keys”,再点击“New SSH Key”,将本地~/.ssh/id_rsa.pub
中的内容复制进去。
2.修改本地git的remote url
在代码仓库复制ssh地址,然后在本地执行:
git remote set-url origin ssh地址