Git pust認證失敗(authentication failed)

學習git指令pust時,需要帳號及密碼,輸入完成後卻出現錯誤:
E:\> git push -u origin master
Username for 'https://github.com': XXXXX
Password for 'https://XXXXX@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/XXXXX/test01.git/'

原因在於我有啟用GitHub的兩階段認證,也就是登入時需要輔以手機認證。
雖然增加了安全性,但是卻讓Git push時無法驗證密碼。
還好GitHub有另外的方法可以解決這個問題,官方問與答中有提到:
If you have enabled two-factor authentication,
you must provide a personal access token instead of entering your password for HTTPS Git.
(https://help.github.com/articles/https-cloning-errors/#provide-access-token-if-2fa-enabled)

所以我必須先設定好personal access token來取代輸入的密碼才行。


開啟瀏覽器並由網頁登入GitHub後,在選單中選擇「Settings」


網頁切換之後,在左邊的選單中,選擇「Personal access tokens」

按下「Generate new token」準備產生一組新的token

輸入tokey的名稱後,按下「Generate token」以實際產生token

把紅色圈選處的文字複製下來並記起來,這就是我們的token,
這裡有一個地方要注意,一旦我們退出此頁之後,就只能看到token名稱,
無法再次看到內容,如果沒有把toekn記錄下來的話,就只能刪除後再重新產生了。

接著在以Git pust出現要輸入密碼時,輸入token就可以通過認證了。



Oracle DB的listener.log清理