1 问题描述
遇到这个问题:remote: Support for password authentication was removed on August 13, . Please use a personal access token instead.
shanph@shanph:~/Documents/slam$ git clone /shanpenghui/ImuExercise.gitCloning into 'ImuExercise'...remote: Support for password authentication was removed on August 13, . Please use a personal access token instead.remote: Please see https://github.blog/-12-15-token-authentication-requirements-for-git-operations/ for more information.fatal: unable to access '/shanpenghui/ImuExercise.git/': The requested URL returned error: 403
原先的密码凭证从8月13日开始就不能用了,必须使用个人访问令牌(personal access token),就是把密码替换成token!
2 为什么要把密码换成token
首先,官方解释为:
https://github.blog/-12-15-token-authentication-requirements-for-git-operations/
1、修改为token的动机
我们描述了我们的动机,因为我们宣布了对 API 身份验证的类似更改,如下所示:
近年来,GitHub 客户受益于 的许多安全增强功能,例如双因素身份验证、登录警报、经过验证的设备、防止使用泄露密码和 WebAuthn 支持。 这些功能使攻击者更难获取在多个网站上重复使用的密码并使用它来尝试访问您的 GitHub 帐户。 尽管有这些改进,但由于历史原因,未启用双因素身份验证的客户仍能够仅使用其GitHub 用户名和密码继续对 Git 和 API 操作进行身份验证。
从 年 8 月 13 日开始,我们将在对 Git 操作进行身份验证时不再接受帐户密码,并将要求使用基于令牌(token)的身份验证,例如个人访问令牌(针对开发人员)或 OAuth 或 GitHub 应用程序安装令牌(针对集成商) 上所有经过身份验证的 Git 操作。 您也可以继续在您喜欢的地方使用 SSH 密钥(如果你要使用ssh密钥可以参考)。
2、修改为token的好处
令牌(token)与基于密码的身份验证相比,令牌提供了许多安全优势:
唯一: 令牌特定于 GitHub,可以按使用或按设备生成
可撤销:可以随时单独撤销令牌,而无需更新未受影响的凭据
有限 : 令牌可以缩小范围以仅允许用例所需的访问
随机:令牌不需要记住或定期输入的更简单密码可能会受到的字典类型或蛮力尝试的影响
3 如何生成自己的token
1. 在个人设置页面,找到Setting(参考)
2. 选择开发者设置Developer setting
3.选择个人访问令牌Personal access tokens,然后选中生成令牌Generate new token
4. 设置token的有效期,访问权限等
5. 生成令牌Generate token
注意:
记得把你的token保存下来,因为你再次刷新网页的时候,你已经没有办法看到它了
6. 之后用自己生成的token登录,把上面生成的token粘贴到输入密码的位置,然后成功push代码!
例如:
git clone https://<your_token>@/username/project_name.git
如果觉得《github remote: Support for password authentication was removed on August 13 .》对你有帮助,请点赞、收藏,并留下你的观点哦!