remote: Support for password authentication was removed


周末提交代碼,把代碼push到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

表示遠程推送不再支持密碼驗證了,改成 token 驗證了。

解決方案

  1. 首先要生成token,在 github 上找到setting -> Developer settings ->Personal access tokens->Generate new token
    找到生成token路徑

在配置頁面配置好權限后,即可生成token,注意這里需要保存好token,因為只顯示一次

  1. 設置token,這里分成兩種情況,代碼已經有的,遠程倉庫地址添加token;沒有代碼的,在git clone添加token
  • 修改遠程倉庫添加token
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
  • git clone 添加token
git clone https://<your_token>@github.com/<USERNAME>/<REPO>.git

添加好token就可以推送和下拉代碼了。

遇到的坑

  1. 在idea上的github上設置token沒效果,這個具體原因未知
  2. 網上一大堆介紹如果生成token,但是重點是第二步,添加或者更新token。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM