天天看點

解決remote: Support for password authentication was removed on August 13, 2021. Please use a perso

引言

jenkins中通過username+password的方式拉取Github代碼報錯如下:

$ git pull
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/<USERNAME>/<REPO>.git': The requested URL returned error: 403
           

自從21年8月13後不再支援使用者名密碼的方式驗證了,需要建立個人通路令牌(personal access token)。

解決問題

生成令牌

  1. 首先生成一個令牌,←連結是官網教程,也可以不點,直接看下文。
    解決remote: Support for password authentication was removed on August 13, 2021. Please use a perso
  2. 點選左側的Developer settings
    解決remote: Support for password authentication was removed on August 13, 2021. Please use a perso
  3. 選擇 Generate new token(classic)
    解決remote: Support for password authentication was removed on August 13, 2021. Please use a perso
  4. 設定token資訊
    解決remote: Support for password authentication was removed on August 13, 2021. Please use a perso
    解決remote: Support for password authentication was removed on August 13, 2021. Please use a perso
    點選Generate token生成令牌
  5. 得到生成的令牌
    解決remote: Support for password authentication was removed on August 13, 2021. Please use a perso
  6. 應用令牌

    将生成的令牌拷貝下來(不要拷貝我的,拷貝你自己生成的!),記得儲存,下次你就看不到了。

對于全新版本,克隆的時候也在github.com前面加個令牌就好了。

git clone https://<TOKEN>@github.com/<user_name>/<repo_name>.git
           

示例:

https://[email protected]/iRayCheung/getSign.git/
           

此時再執行git pull,即可拉取對應倉庫代碼。