Github push推东西的时候突然报错了,一查发现是换了认证方式的原因,之前输入密码push,现在得改用token了,但是网上重置仓库密码啥的试了push都还是失败。
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: unable to access 'https://github.com/anzhihe/Efficient-office.git/': The requested URL returned error: 403
github通知如下:
Git password authentication is shutting down
As previously announced, starting on August 13, 2021, at 09:00 PST, we will no longer accept account passwords when authenticating Git operations on GitHub.com. Instead, token-based authentication (for example, personal access, OAuth, SSH Key, or GitHub App installation token) will be required for all authenticated Git operations.
Please refer to this blog post for instructions on what you need to do to continue using git operations securely.
Removal
August 13, 2021, at 09:00 PST
解决方法如下:
创建个人访问token,Creating a personal access token
更改认证方式,Caching your GitHub credentials in Git,以我用的MacOS为例
⑴.Install Git using Homebrew:
$ brew install git
⑵.Install GCM Core using Homebrew:
$ brew tap microsoft/git $ brew install --cask git-credential-manager-core
For MacOS, you don't need to run
git config
because GCM Core automatically configures Git for you.
安装好pkg再push的话就会弹出一个认证框,选择token登陆,输入生成的token就ok啦,世界终于又归于清静了~!
手动操作方法:
方法一:重新git clone项目
方法二:执行git config --local credential.helper "",然后git push输入密码的时候输入token代替
方法三:执行git config --global --unset credential.helper,然后git push输入用户名和token,打开家目录下的隐藏文件.git-credentials,将新生成的token替换旧密码保存,再执行git config --global credential.helper store即可
参考: