解決 Password authentication is temporarily disabled as part of a brownout 問題
前言
今天要上傳程式碼的時候出現 GitHub 「remote: Password authentication is temporarily disabled as part of a brownout」的狀況,所以這邊紀錄一下如何解決。
更新
更新一下,建議使用 ssh 模式來使用 GitHub,以下方法不一定可以解決上傳的問題,建議還是將自己 GitHub 上傳模式改成 ssh 會比較穩定,詳情設定可見「使用 SSH 連接/上傳到你的 GitHub(Ed25519)」
錯誤訊息
主要是我輸入 git push
之後會發生以下錯誤訊息
1 | remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead. |
簡單來講就是不希望你再透過 HTTP 的密碼驗證方式,因此這邊最簡單方式就是重新 git clone
,但是這邊要注意改用 ssh
方式 clone
ssh 的 Url 會是這樣:git@github.com:hexschool/live-vue3-training-chapter-works.git
HTTPS 則是:https://github.com/hexschool/live-vue3-training-chapter-works.git
因此建議改用 ssh 的方式 clone 就可以解決了。
如果不想重新 clone 的話,只需要將 Git 的 remote url 改成 ssh 的就可以了,以上面範例來講,只需要樣輸入指令即可:
1 | git remote set-url origin https://github.com/hexschool/live-vue3-training-chapter-works.git |
至於會發生這個問題的原因是因為 GitHub 官方在 2020 年 11 月 13 日開始陸續不支援使用帳號密碼的身份認證,也就是 HTTPS 的模式上傳,但是官方有提到,如果你的 GitHub 帳號有設置二次驗證的話,那麼是不會受到這個新機制影響的
If you have two-factor authentication enabled for your account, you will not be affected by the future Git authentication changes.
所以說可以到二次驗證啟用頁面啟用 (但我不知道為什麼啟用後還是無效,說不定有時差吧?)
Hexo 部署
如果是 Hexo 無法上傳的話,只需要到 _config.yml
修改部署那一段,將原本的下方這一段
1 | deploy: |
也將 repo 改成 ssh 就可以哩
1 | deploy: |