一、问题:
今天发现用idea直接往github上提交代码报如下错误:
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.
Authentication failed for 'https://github.com/AlexhahahaDrag/alex_blog.git/'
了解发现,github从2021-08-13不支持账号密码验证,需要使用一个pesonal access token来代替。
二、操作
在控制台上输入如下代码就可以由之前的账号密码切换到token了
git remote set-url origin <personal_access_token>/<username>/<rep>.git
三、token获取
1.登录github后点击右上角头像,然后选择settings
2. 选择”developer settings“
3.选择”personal access token“
4.配置token信息
5.生成的token要保存好,关闭页面后就看不到这个token了