解决 remote Support for password authentication was removed on August 13, 2021.

解决 remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

问题原因

Logon failed, use ctrl+c to cancel basic credential prompt.
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/dream-code-kangli/online-learning.git/'

意思是自从 21 年 8 月 13 后不再支持用户名密码的方式验证了,需要创建个人访问令牌(personal access token)。

解决方法

在 GitHub 上生成令牌,应用于所需的仓库中

  1. 点击 settings

解决 remote Support for password authentication was removed on August 13, 2021._第1张图片

  1. 点击右侧的 Developer settings

解决 remote Support for password authentication was removed on August 13, 2021._第2张图片

  1. 点击 Personal access tokens(个人访问令牌)

解决 remote Support for password authentication was removed on August 13, 2021._第3张图片

  1. 点击 Generate new token
    解决 remote Support for password authentication was removed on August 13, 2021._第4张图片

  2. 设置 token 信息
    解决 remote Support for password authentication was removed on August 13, 2021._第5张图片

根据所需过期时间,建议设置成永远,以免麻烦,建议所有选项都选上

点击 Generate token 生成令牌

  1. 得到生成的令牌

解决 remote Support for password authentication was removed on August 13, 2021._第6张图片

  1. 应用令牌

将生成的令牌拷贝下来,记得保存,下次你就看不到了。

修改现有的 url

git remote set-url origin  https://<your_token>@github.com/<USERNAME>/<REPO>.git

换成你自己得到的令牌。是你自己github的用户名,是你的项目名称

换成你自己得到的令牌。是你自己github的用户名,`是你的项目名称

然后再次执行 pull push 操作,大功告成。

你可能感兴趣的:(git,git,github)