引言

收到一封github的邮件,说我最近使用密码访问了github的仓库。表示不久之后使用密码验证的方式将会失效

Hi @lanfengqiuqian,

You recently used a password to access the repository at xxx with git using git/1.8.3.1.

Basic authentication using a password to Git is deprecated and will soon no longer work. Visit https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information around suggested workarounds and removal dates.

Thanks,
The GitHub Team

并且真实的,在使用git push提交代码的时候提示错误:

remote: Password authentication is not available for Git operations.
remote: You must use a personal access token or SSH key.
remote: See https://github.ibm.com/settings/tokens or
'https://github.ibm.com/WBurney/Blockchain_SDO.git/': 
The requested URL returned error: 403

原因

现在github出于安全的考虑,将在2021年8月停止使用账号和密码的方式访问github仓库,改为token认证的方式。

解决方案

登录github,生成token令牌进行认证即可。

  1. github右上角设置
    在这里插入图片描述
  2. 开发者设置
    在这里插入图片描述
  3. 个人访问令牌
    在这里插入图片描述
  4. 生成一个新的令牌
    在这里插入图片描述
  5. 输入登录密码
  6. 填写描述、过期时间、选择权限范围
    在这里插入图片描述
  7. 提交
    在这里插入图片描述
  8. 复制令牌并保存起来(只会出现一次,之后将不会再次出现)
    在这里插入图片描述
  9. 然后再需要验证密码的地方使用这个令牌即可

传送门

关于github个人令牌的说明,可以参见这位大佬的文章

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐