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://[email protected]/ZhangSan/TestProj.git/

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章