hexoをデプロイした際に、github.com からメールが届いた。
2021年8月13日からトークン認証が必要になるってメールが来た。
Token authentication requirements for Git operations - The GitHub Blog
まだ2ファクタ認証にしてなかったので、手順をメモ。
- github.com の setting を開く
- アカウントのセキュリティを開く
- Two-factor authentication 画面が開く
- 「Enable two-factor authntication」をクリック
- 「Set up using an app」をクリック
- Recovery codes で回復コードを保存する
- 保存したら、「Next」へクリック
- Recovery codes で回復コードを保存する
- Scan this barcode with your app. でQRコードをコピーし、1passwordで保管する
- Scan this barcode with your app. でQRコードをコピーし、1passwordで保管する
- 1Passwordを開く
- github.com を開き、「編集」
- ラベル → 新規フィールドの右側にあるセレクトボックスを「ワンタイムパスワード」に変更
- QRアイコンをクリックし、QRコードをペースト
- 保存する
- ワンタイムパスワードをコピー
- 「Enter the six-digit code from the application」にペーストし、「Enable」をクリック
- hexo の _config.yaml の deploy 部分の下に token の行を加える
deploy: type: git repo: https://github.com/makotoworld/makotoworld.github.io branch: master token: $GITHUB_TOKEN
- github.com に Personal access tokens を設定し、アクセストークンをコピーする
- 取得したアクセストークンを $GITHUB_TOKEN 変数に設定する
これで、hexo d -g
するとパスワードを求められるので、それにしたがって入力するとデプロイができる