GitHub不再支持密码验证解决方案:SSH免密与Token登录配置
问题描述
今天提交代码,push到GitHub上,突然出现这个问题。
1 | remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. |
官方的解释:https://github.blog/changelog/2021-08-12-git-password-authentication-is-shutting-down/
As previously announced, starting on August 13, 2021, at 09:00 PST, we will no longer accept account passwords when authenticating Git operations on GitHub.com. Instead, token-based authentication (for example, personal access, OAuth, SSH Key, or GitHub App installation token) will be required for all authenticated Git operations.
Please refer to this blog post for instructions on what you need to do to continue using git operations securely.
Removal
August 13, 2021, at 09:00 PST
大致意思是,密码验证于2021年8月13日不再支持,也就是今天intellij不能再用密码方式去提交代码。请用使用 personal access token 替代。
解决方案
GitHub Token
打开自己的GitHub主页,点击自己的头像找到Settings并进入,在左边目录栏找到Personal access tokens,点击Generate new token,按照步骤申请即可,过程简单。
![](https://cdn.jsdelivr.net/gh/gaoyanliang/cdn@main/blog/img/post/tools/g1.png)
Scopes(范围)那里建议勾选 ‘repo’ 即可。
![](https://cdn.jsdelivr.net/gh/gaoyanliang/cdn@main/blog/img/post/tools/g2.png)
创建Token成功后复制这个Token:
![](https://cdn.jsdelivr.net/gh/gaoyanliang/cdn@main/blog/img/post/tools/g3.png)
以下操作针对于Window操作系统,首先打开控制面板,将查看方式切换到“小图标”,再打开“凭据管理”。
![](https://cdn.jsdelivr.net/gh/gaoyanliang/cdn@main/blog/img/post/tools/g4.png)
选择“Window凭据”:
![](https://cdn.jsdelivr.net/gh/gaoyanliang/cdn@main/blog/img/post/tools/g5.png)
向下滑动找到“github”:
![](https://cdn.jsdelivr.net/gh/gaoyanliang/cdn@main/blog/img/post/tools/g6.png)
点击编辑,再将刚刚复制的Token粘贴到密码处点击保存:
再次操作就不会出现刚才的报错了,其他操作系统也有相应的修改凭据操作,可以尝试一下。