背景
Support for password authentication was removed on August 13, 2021 在使用 Git 上传将本地仓库推送到远程服务器时,出现了以下问题:
Username for 'https://github.com': xxx
Password for 'https://xxx@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/xxxx/xxx.git/'
大概意思就是自 2021年 8 月 13日开始,Github 中通过 用户名 + 密码的认证方式被移除了,只能通过个人访问码的方式进行认证。
所以需要做的是在GitHub上创建一个Personal access token,然后在项目的.git/config里修改url添加token。
一、创建Token
1.进入设置  2.下滑进入开发者设置  3.进入token管理,创建新的token  4.设置别名和过期时间,为方便可以设置一个永不过期的,权限可以全都勾选  5.点击生成  6.将生成的token自己保存,因为以后就不再显示了 
二、仓库的URL中添加token
格式如下: http://tokens-name:your_token@github.com/your_username/your_username.git 将your_token、your_username、your_username替换成你自己的即可。 可以直接在.git/config的配置文件里修改。 之后就可以正常的push项目了。
参考
https://blog.csdn.net/weixin_45508265/article/details/124340158 https://blog.csdn.net/FatalFlower/article/details/119717823
|