解决github:Support for password authentication was removed.
git push origin master报错:Support for password authentication was removed.
是因为2021年8月13日,git不再支持密码方式验证,而是建议使用token
所以需要先生成自己的token:
token生成
个人设置 > Settings > Developer Settings > Personal access tokens > Generate new token(自己用权限都选上)
注意:新生成的token一定要保存起来,你再次进网站就找不到token了!
token使用
- clone新的项目时,拼接token和http链接:https://$GH_TOKEN@github.com/owner/repo.git
- clone新的项目时使用http链接,密码换成token
- 已经clone的项目,在.git/config中将原来的http中加入token:https://$GH_TOKEN@github.com/owner/repo.git