背景:
突然无法上传代码到git了,报如下错误:
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/EdenLiu/TestCode.git/'
解决方案:
需要使用token进行权限校验才能重新使用git.
按照官网教程处理
生成Token
setting ->Developer settings->personal access tokens->Generate new token
Note自己想写啥写啥,超时时间自用的话可以选 永久,复选框自用的话就都选上,最后点击generate token.
生成如下图:
主要保存到token,下次再进来就再也看不到了
应用Token
修改现有项目的url
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
将<your_token>
换成你自己得到的令牌。<USERNAME>
是你自己github的用户名,<REPO>
是你的项目名称,比如:
git remote set-url origin https://ghp_wYAehQdyYEMXKLxJ3Z2F5ZwQF39LTZ2wyWUw@github.com/EdenLiu/TestCode.git
就OK了