SourceTree Push 代码报错:remote: Support for password authentication was removed on April 26, 2022.
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.
解决方案:生成自己的token
1、在个人设置页面
,找到Setting

2、在左侧列表中,选择开发者设置Developer setting

3、选择个人访问令牌Personal access tokens,然后选中生成令牌Generate new token

4、设置token的有效期,访问权限等
选择要授予此令牌token的范围或权限。
要使用token从命令行访问仓库,请选择repo。
要使用token从命令行删除仓库,请选择delete_repo
其他根据需要进行勾选

截屏2021-08-16 下午2.46.06.png
5、生成令牌Generate token

token生成成功!

注意:
记得把你的token保存下来,因为你再次刷新网页的时候,你已经没有办法看到它了!
6、之后用自己生成的token登录,把上面生成的token粘贴到输入密码的位置,然后成功push代码!
也可以 把token直接添加远程仓库链接中,这样就可以避免同一个仓库每次提交代码都要输入token了:
(1) 在sourceTree中操作,点击右上角设置

(2) 编辑远程仓库链接

git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git <your_token>:换成你自己得到的token <USERNAME>:是你自己github的用户名 <REPO>:是你的仓库名称
例如:
git remote set-url origin https://ghp_xxxxxxxxxxxxxxxxxx@github.com/ZhangSan/TestProj.git/