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/
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库