# GitHub Deprecation Notice by Jiang ###### tags: `Jiang` `2021夏季切版班` ## GitHub Deprecation Notice :::danger WTF !!! 信件內容如下: ![](https://i.imgur.com/NuKVKyE.jpg) (當然你也可以選擇不設定,但官方已經提醒 8/13 這個日期了 1. For developers, if you are using a password to authenticate Git operations with GitHub.com today, you must begin using a personal access token over HTTPS (recommended) or SSH key by August 13, 2021, to avoid disruption. If you receive a warning that you are using an outdated third-party integration, you should update your client to the latest version. 2. For integrators, you must authenticate integrations using the web or device authorization flows by August 13, 2021, to avoid disruption. For more information, see Authorizing OAuth Apps and the announcement on the developer blog. ### 時間提醒 * Today – If you are using passwords to authenticate Git operations with GitHub.com today, you will soon receive an email urging you to update your authentication method or third-party client.(如果還沒更新 authentication method,會一直收到這封信 ) * June 30 and July 28, 2021 – Token (or SSH key) authentication will be temporarily required for all Git operations to encourage affected customers to update their authentication method (see below). * August 13, 2021 – Token (or SSH key) authentication will be required for all authenticated Git operations. ::: ## Token authentication requirements for Git operations [官方文章在此,請自行翻譯唷](https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/) 簡言之:使用 Git 密碼的身份驗證已被棄用,很快就不能用啦。 Basic authentication using a password to Git is deprecated and will soon no longer work. Visit https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information around suggested workarounds and removal dates. ### Workflows affected 受災戶 只要工作流程上用到 git 指令需要輸入帳號密碼的驗證方式都會受到影響 但使用 GitHub Desktop 不會有影響喔 1. Command line Git access 1. Desktop applications using Git (GitHub Desktop is unaffected) 1. Any apps/services that access Git repositories on GitHub.com directly using your password ### 為了不被影響,可以有以下幾個方法 ( 我自己是先用 two-factor authentication ) The following customers remain unaffected by this change: 1. If you have two-factor authentication enabled for your account, you are already required to use token- or SSH-based authentication. 1. If you use GitHub Enterprise Server, we have not announced any changes to our on-premises offering. 1. If you maintain a GitHub App, GitHub Apps do not support password authentication. ### Two-factor authentication 啟用 ![](https://i.imgur.com/RiMBQa3.jpg) 兩者都可以選,但因為我懶的下載app,所以我個人選了SMS,接下來就是跟著頁面流程做就可以了 ![](https://i.imgur.com/DAzrVqt.jpg) 設定完成的頁面是這樣 ![](https://i.imgur.com/jPXojWU.jpg) **好啦,設定完成囉,接下來就是去測試要上傳的檔案囉!** > 補充:救援碼選擇APP & SMS驗證都會有 recovery codes (恢復碼),就是驗證會需要的密碼組,請大家下載保存好這個資料,下載下來是一個txt檔案,請留存! #### WTF!!! 設定好了為何出現錯誤訊息 remote: Invalid username or password > 如果你帳密都對,但出現以下錯誤的話 > remote: Invalid username or password. > fatal: Authentication failed for 'https://github.com/xxxxxxxx.git/' 推判是帳戶安全設定設有二次驗證(Two-factor authentication)導致 git 被擋住 (待查證) #### 解決方法可以用 personal access token 的方式取代密碼來進行登入 [Creating-a-personal-access-token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-token ) > 進入 settings > Developer settings > ![](https://i.imgur.com/aTt2iCi.jpg) ![](https://i.imgur.com/CIbtCJY.jpg) ![](https://i.imgur.com/MZJj6id.jpg) Personal access tokens >Generate new token ( 設定 Token名稱,以及存取權限 > 點選 產生token (Generate token),接著這裡會跳出一串代碼,請趕快複製,這 token 只會出現一次喔,錯過要再重新設定 ) ![](https://i.imgur.com/9cQhhCX.jpg) 好,設定完畢後重啟終端機,接下來可以試試看上傳 ### 在最後步驟 git push 時會出現兩個選項 > **系統可能會問你要選擇** > 1. Web Browser > 2. Personal access token > > 還記得我們本來是用 1 web broser 吧 > **這次記得選 2 Personal access token** 然後,跟選1的時候一樣,會引導你填入該填的帳號密碼 ( 請注意,這裡要填的是 personal access token )