C/C++教程

github Support for password authentication was removed

本文主要是介绍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. 避免了个人的弱密码
这篇关于github Support for password authentication was removed的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!