現象
$ 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地址