因为github从2021.08.13开始就不支持账号密码方式提交代码。
使用用户名+密码,推送代码到GitHub会提示:
Push failed
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.
github官网也给出如下链接:
https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations
网上大都是ssh key方式,不过觉得有点麻烦,所以直接使用access Token的方式
生成AccessToken:
登录后点击头像,再点击Settings,如图所示:
然后点击Developer settings:
选择Personal access tokens,然后点击generate new Token:
Note,说明、注释。 Expiration是token的过期时间,根据自己需要进行设置即可:
权限设置:因为是自己的项目,所以全部勾选上了:
点击Generate Token之后,就会生成token,同时会给你邮箱发一份邮件
然后切换到idea,修改原来的Git地址:
在原来Git路径github.com前面添加:你自己的token@
等待检查路径:
因为GitHub是国外网站,所以检查路径可能会超时:多试几次,直到没有超时提示即可
再次Push…即可正常推送到GitHub上了。



