github Support for password authentication was removed

问题

2021年8月13号,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.
fatal: Authentication failed for 'https://github.com/xxx'

原因

github取消了密码登陆推送,改用了访问令牌模式。

解决办法

  1. Log into GitHub with your username and password
  2. Navigate to your GitHub account settings
  3. Scroll down and click ‘Developer settings’ in the list of links to the left
  4. Click the Personal access tokens link
  5. Click the ‘Generate new token’ button
  6. Add a ‘Note’ to describe the tokens usage
  7. Set an expiration date for the GitHub personal access token
  8. Select the appropriate authentication scope
  9. Click the ‘Generate token’ button

然后页面上会生成一个随机字符串的秘密,你要复制保存下来,将它作为push的密码输入。注意:这个密码只显示一次,如果丢失,重复上述过程重新生成一个。

由于它太随机,无法人工记忆,因此可以使用git缓存下来

git config --global credential.helper 'cache --timeout=3600'

意义

  1. 避免了个人密码的泄漏
  2. 保证了github平台的安全性
  3. 避免了个人的弱密码
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值