周末提交代码,把代码push到github上,控制台报了上面的谬误:

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

示意近程推送不再反对明码验证了,改成 token 验证了。

解决方案

  1. 首先要生成token,在 github 上找到setting -> Developer settings ->Personal access tokens->Generate new token

在配置页面配置好权限后,即可生成token,留神这里须要保留好token,因为只显示一次

  1. 设置token,这里分成两种状况,代码曾经有的,近程仓库地址增加token;没有代码的,在git clone增加token
  • 批改近程仓库增加token

    git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
  • git clone 增加token

    git clone https://<your_token>@github.com/<USERNAME>/<REPO>.git

    增加好token就能够推送和下拉代码了。

遇到的坑

  1. 在idea上的github上设置token没成果,这个具体起因未知
  2. 网上一大堆介绍如果生成token,然而重点是第二步,增加或者更新token。