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/
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值