remote Support for password authentication was removed on August 13, 2021
本文主要介绍 github 开发人员在七夕搞事情:remote: Support for password authentication was removed on August 13, 2021.
问题描述
如果你在七夕(没错就是 2021 年 8 月 14 日)的这一天刚好加班,又刚好去访问了全球最大的同性交友网站,又刚好去更新提交代码,又或你创建了一个新的仓库送给自己,又刚好想把这个仓库送给(push)github,你就刚好会遇到这个问题:remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
具体如下:
1 | git push |
这是什么情况,大概意思就是你原先的密码凭证从2021年8月13日开始就不能用了,必须使用个人访问令牌(personal access token),就是把你的密码替换成token!
github 为什么要把密码换成 token
修改为 token 的好处
令牌(token)与基于密码的身份验证相比,令牌提供了许多安全优势:
唯一: 令牌特定于 GitHub,可以按使用或按设备生成
可撤销:可以随时单独撤销令牌,而无需更新未受影响的凭据
有限 : 令牌可以缩小范围以仅允许用例所需的访问
随机:令牌不需要记住或定期输入的更简单密码可能会受到的字典类型或蛮力尝试的影响
如何生成自己的 token
在
个人设置页面,找到Setting链接
2、选择设置Developer setting,选择个人访问令牌Personal access tokens,然后选中生成令牌Generate new token

设置 token 的有效期,访问权限等
选择要授予此
令牌token的范围或权限。
要使用
token从命令行访问仓库,请选择repo。要使用
token从命令行删除仓库,请选择delete_repo其他根据需要进行勾选

生成令牌
Generate token

注意:记得及时把你的 token 保存下来,因为你再次刷新网页的时候,你已经没有办法看到它了
之后用自己生成的
token登录,把上面生成的token粘贴到输入密码的位置,然后成功push代码!
1 | git push |
也可以 把token直接添加远程仓库链接中,这样就可以避免同一个仓库每次提交代码都要输入token了:
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
<your_token>:换成你自己得到的token<USERNAME>:是你自己github的用户名<REPO>:是你的仓库名称
例如:
git remote set-url origin https://ghp_LJGJUevVou3FXXXXXXXXXXXXXX@github.com/MrSeaWave/blogs/
FAQ
如果
push等操作没有出现输入密码选项,请先输入如下命令,之后就可以看到输入密码选项了git config --system --unset credential.helperSourceTree也遇到类似问题当
SourceTree提交时遇到:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16Pushing to https://github.com/MrSeaWave/MacApp.git
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/MrSeaWave/MacApp.git/'
Pushing to https://github.com/MrSeaWave/MacApp.git
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/MrSeaWave/MacApp.git/'
Pushing to https://github.com/MrSeaWave/MacApp.git
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/MrSeaWave/MacApp.git/'
Pushing to https://github.com/MrSeaWave/MacApp.git
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/MrSeaWave/MacApp.git/'可以
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git也可以:(密码处填写
token)

参考链接
github 开发人员在七夕搞事情:remote: Support for password authentication was removed on August 13, 2021.
remote Support for password authentication was removed on August 13, 2021
https://hailangya.com/articles/2021/08/29/github-login-token/


