今天提交代碼,push到GitHub上阔蛉,突然出現(xiàn)這個(gè)問(wèn)題。
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/zhoulujun/algorithm.git/': The requested URL returned error: 403
官方的解釋?zhuān)?a target="_blank">https://github.blog/changelog/2021-08-12-git-password-authentication-is-shutting-down/
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
大致意思是癞埠,密碼驗(yàn)證于2021年8月13日不再支持状原,也就是今天intellij不能再用密碼方式去提交代碼。請(qǐng)用使用 personal access token 替代苗踪。
這個(gè)去年年底就說(shuō)了颠区,https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
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,煩人的很通铲。還是覺(jué)得直接ssh 的方式操作git就好(之前是ssh的源毕莱,也沒(méi)有這個(gè)問(wèn)題)。
github配置SSH免密登錄
這里講的是Mac OS 操作颅夺。windows可以借鑒
查看ssh目錄
ls -al ~/.ssh
Mac OS目錄~/.ssh央串,windows目錄是: Users/uestc/.ssh/id_rsa
-如果有配過(guò),會(huì)列出:
id_rsa (私鑰)——這個(gè)不能泄露
id_rsa.pub(公鑰)
-如果沒(méi)有配過(guò)碗啄,那么就進(jìn)入第二步
新建一個(gè)新的SSH KEY
ssh-keygen -t rsa -b 4096 -C "uestchan@sina.com"
接著會(huì)提示這個(gè)公鑰私鑰的保存路徑-建議直接回車(chē)就好(默認(rèn)目錄里)
接著提示輸入私鑰密碼passphrase - 如果不想使用私鑰登錄的話(huà)质和,私鑰密碼為空,直接回車(chē)
生成成功后稚字,把 id_rsa.pub 拷貝到 github 新建的 SSH keys 中
配置好好饲宿,記住,你項(xiàng)目得使用 SSH clone
如果本地是https 源胆描,那么就修改git 倉(cāng)庫(kù)地址
git修改遠(yuǎn)程倉(cāng)庫(kù)地址
方法有三種:
- 1.修改命令
- git remote origin set-url [url]
- 先刪后加
git remote rm origin
git remote add origin [url]
- 直接修改config文件
- git文件夾瘫想,找到config,編輯昌讲,把就的項(xiàng)目地址替換成新的国夜。
關(guān)于github 建議讓換 Token的形勢(shì),操作如下
GitHub token
打開(kāi)自己的GitHub主頁(yè)短绸,點(diǎn)擊自己的頭像找到Settings并進(jìn)入车吹,在左邊目錄欄找到Personal access tokens筹裕,點(diǎn)擊Generate new token,按照步驟申請(qǐng)即可窄驹,過(guò)程簡(jiǎn)單朝卒。Scopes(范圍)那里建議全選。
Token申請(qǐng)成功后乐埠,將Token復(fù)制到Token一欄中
操作路徑:
生成新的token就好抗斤。權(quán)限我是全部勾選上的。
Intellij IDEA 上Github賬號(hào)校驗(yàn)
配置Git路徑
打開(kāi)Settings(File-->Settings) --> 在搜索欄內(nèi)輸入git丈咐,回車(chē)跳轉(zhuǎn)到Git配置頁(yè)面 --> 將git的運(yùn)行路徑填入Path to Git executable一欄(一般IDEA會(huì)自動(dòng)定位)
配置GitHub賬戶(hù)密碼
第一種方法可以選擇使用帳號(hào)密碼認(rèn)證(Password)
之前的老板是這樣的
在Login一欄填入你GitHub的用戶(hù)名 --> Password那欄填入你GitHub的登錄密碼
現(xiàn)在新版本的瑞眼,點(diǎn)擊密碼登錄,會(huì)自動(dòng)跳轉(zhuǎn)到登錄驗(yàn)證頁(yè)面棵逊,在驗(yàn)證頁(yè)面點(diǎn)擊確定(我的密碼是chrome記住的)负拟。就自動(dòng)登錄
選擇log width token,填入token就好