git报错#Support for password authentication was removed on August 13,2021


前言

好久没有用github了,今天想将本地的一个项目推送到github上面。但是今天推送代码到github上面的时候,却一直报错!

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.

翻译:

remote: Support for password authentication was removed on August 13,2021.
远程:对密码身份验证的支持已于 2021 年 8 月 13 日删除。
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls

二、报错解决

打开github仓库主页,点击右侧头像。显示当前下拉框,并点击进入自己的仓库的设置界面

在设置界面左侧,找到红色方框部分,点击进入开发者设置界面

找到红色方框部分,点击进入

点击红色方框,设置

这里的名称我的是:accessToken

作用时间范围,我为了方便设置的是90天
功能,因为是自己的项目和自己仓库,所以我都选择了
之后点击下面的绿色按钮就可以创建口令了

创建成功之后,会看到

复制红色方框内容,来到git 设置界面

git remote set-url 远程仓库的名称(默认为origin) https://刚刚复制的口令@github.com/你的仓库的用户名称/仓库名称.git

总结

要紧跟时代的步伐啊,不然到时候自己的项目或者什么出问题了,都不知道什么原因。这里提醒自己要记得定期查看关注自己项目技术的官方消息,以免一些更新我们不知道,导致错误。