はじめに
GitHub で 2FA(2段階認証・2要素認証) を設定したアカウントの Private Repository を Clone する方法。
サーバなど普段使いの PC 以外で Private Repo をクローンしたい時など。
TL;DR
- 2FA 未設定
git clone https://<user>@github.com/<repo user>/<repo>.gitでいける
- 2FA 設定済
- New personal access token で新規トークンを作成
git clone https://<user>@github.com/<repo user>/<repo>.gitのパスワードにトークンを入力
- パスワード/トークン を保持したい場合
credential.helperを設定git config credential.helper cacheで一時保持git config credential.helper storeで保存