问题描述
今天写了点儿学习设计模式的代码,可是在push的时候报错了
$ git push
remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead.
remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information.
fatal: unable to access 'https://github.com/zjxht62/learnJava.git/': The requested URL returned error: 403
大体意思是,之前的使用密码的验证方式已经不能再使用了。
点开他提示的连接,看看
https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/
其中主要说的就是现在有很多新的安全改进,比如双重身份验证、登录警报等,但是还是有很多老用户仍然使用用户名和密码来操作Git,这不安全!现在不让你们用用户名加密码来验证了,要用access token了。
解决
所以你得先去生成个access token。
生成之后,由于我自己之前执行了下面的命令,设置了存储登录凭据(默认存储在~/.git-credentials)
git config --global credential.helper store
所以我需要执行下面这条命令来清除已存储的信息
git config --global --unset credential.helper
再次执行git push,会提示输入用户名和密码,这里密码就输入刚才生成的access token即可
$ git push
Username for 'https://github.com': zjxht62
Password for 'https://zjxht62@github.com':
之后再次保存一下
git config --global credential.helper store