zhoulujun 2021-08-15 17:06:02 阅读数:244
今天提交代碼,push到GitHub上,突然出現這個問題。
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see github.blog/2020-12-15-… for more information.
fatal: unable to access 'github.com/zhoulujun/a…': The requested URL returned error: 403
官方的解釋:github.blog/changelog/2…
As previously announced, starting on August 13, 2021, at 09:00 PST, we will no longer accept account passwords when authenticating Git operations on GitHub.com. Instead, token-based authentication (for example, personal access, OAuth, SSH Key, or GitHub App installation token) will be required for all authenticated Git operations.
Please refer to this blog post for instructions on what you need to do to continue using git operations securely.
Removal
- August 13, 2021, at 09:00 PST
大致意思是,密碼驗證於2021年8月13日不再支持,也就是今天intellij不能再用密碼方式去提交代碼。請用使用 personal access token 替代。
這個去年年底就說了,github.blog/2020-12-15-…
In July 2020, we announced our intent to require the use of token-based authentication (for example, a personal access, OAuth, or GitHub App installation token) for all authenticated Git operations. Beginning August 13, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.
自己鼓搗了一遍 Token,煩人的很。還是覺得直接ssh 的方式操作git就好(之前是ssh的源,也沒有這個問題)。
這裏講的是Mac OS 操作。windows可以借鑒
查看ssh目錄
ls -al ~/.ssh
複制代碼
Mac OS目錄~/.ssh,windows目錄是: Users/uestc/.ssh/id_rsa
-如果有配過,會列出:
id_rsa (私鑰)——這個不能泄露
id_rsa.pub(公鑰)
-如果沒有配過,那麼就進入第二步
ssh-keygen -t rsa -b 4096 -C "[email protected]"
複制代碼
接著會提示這個公鑰私鑰的保存路徑-建議直接回車就好(默認目錄裏)
接著提示輸入私鑰密碼passphrase - 如果不想使用私鑰登錄的話,私鑰密碼為空,直接回車
生成成功後,把 id_rsa.pub 拷貝到 github 新建的 SSH keys 中
配置好好,記住,你項目得使用 SSH clone
如果本地是https 源,那麼就修改git 倉庫地址
方法有三種:
git remote rm origin
git remote add origin [url]
順手安利下 《git寶典—應付日常工作使用足够的指北手册》
關於github 建議讓換 Token的形勢,操作如下
打開自己的GitHub主頁,點擊自己的頭像找到Settings並進入,在左邊目錄欄找到Personal access tokens,點擊Generate new token,按照步驟申請即可,過程簡單。Scopes(範圍)那裏建議全選。
Token申請成功後,將Token複制到Token一欄中
操作路徑:
生成新的token就好。權限我是全部勾選上的。
打開Settings(File-->Settings) --> 在搜索欄內輸入git,回車跳轉到Git配置頁面 --> 將git的運行路徑填入Path to Git executable一欄(一般IDEA會自動定比特)
第一種方法可以選擇使用帳號密碼認證(Password)
之前的老板是這樣的
在Login一欄填入你GitHub的用戶名 --> Password那欄填入你GitHub的登錄密碼
現在新版本的,點擊密碼登錄,會自動跳轉到登錄驗證頁面,在驗證頁面點擊確定(我的密碼是chrome記住的)。就自動登錄
選擇log width token,填入token就好
參考文章:
github配置SSH免密登錄 blog.csdn.net/qq_38163309…
GIT免密登錄神器 SSH KEY配置詳解 blog.csdn.net/w1532127104…
Intellij IDEA 使用GitHub+Git www.cnblogs.com/yysbolg/p/8…
Intellij IDEA 協同 Git 與 GitHub 進行開發使用 www.jianshu.com/p/ea1703adf…
Github 生成token的方法 — IDEA 拉代碼或push失敗需要從新校驗Token blog.csdn.net/SR02020/art…
Intellij IDEA 協同 Git 與 GitHub 進行開發使用 www.jianshu.com/p/ea1703adf…
版权声明:本文为[zhoulujun]所创,转载请带上原文链接,感谢。 https://gsmany.com/2021/08/20210815170542740m.html