解决 remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
问题原因
Logon failed, use ctrl+c to cancel basic credential prompt.
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/dream-code-kangli/online-learning.git/'
意思是自从 21 年 8 月 13 后不再支持用户名密码的方式验证了,需要创建个人访问令牌(personal access token)。
解决方法
在 GitHub 上生成令牌,应用于所需的仓库中
- 点击 settings
- 点击右侧的 Developer settings
- 点击 Personal access tokens(个人访问令牌)
-
点击 Generate new token
-
设置 token 信息
根据所需过期时间,建议设置成永远,以免麻烦,建议所有选项都选上
点击 Generate token 生成令牌
- 得到生成的令牌
- 应用令牌
将生成的令牌拷贝下来,记得保存,下次你就看不到了。
修改现有的 url
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
将<your_token>
换成你自己得到的令牌。<USERNAME>
是你自己github的用户名,<REPO>
是你的项目名称
换成你自己得到的令牌。
是你自己github的用户名,
`是你的项目名称
然后再次执行 pull push 操作,大功告成。