使用sourcetree推送GitHub項目時報錯:
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.
fatal: unable to access ‘https://github.com/xxx/xxx.git/’: The requested URL returned error: 403
這是因為github現(xiàn)在只能使用personal access token登錄楣颠,
github上生成token的方法是尽纽,登錄賬號后,右上角頭像->Settings
->Developer settings
->Personal access tokens
->Generate new token
童漩,
新創(chuàng)建token頁面中弄贿,首先設置token的名字,用于辨識token的作用矫膨,之后選擇token的有效期和設置token的權限作用域差凹,完成后的token只會顯示一次,建議找個地方保存一下侧馅。當然危尿,以后token忘記了,也可以新建一個去使用馁痴。
sourcetree 修改方法:
Mac電腦在sourcetree中進入項目谊娇,點擊右上角【設置】,選擇遠程倉庫济欢,把原本的https://github.com/xxx/yyyy.git
修改成https://ghp_acRdgvdf68rdfsg@github.com/xxx/yyyy.git
,
格式是https://<your_token>@github.com/<USERNAME>/<REPO>.git
image.png
在命令行中法褥,同樣的使用該格式clone https倉庫:
git clone https://<your_token>@github.com/<USERNAME>/<REPO>.git