[GitHub]Deprecation Notice
Github から届いたメール
Hi @hoge,
You recently used a password to access the repository at hoge/fuga with git using git/2.30.1 (Apple Git-130).
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.
Thanks, The GitHub Team
ふむふむ、2021 年 8 月 13 日以降はパスワードを用いたアクセスができなくなるらしい。 そのため、今のうちに 2 段階認証やトークンを用いたアクセスに切り替えればよいとのこと。
上記記事はためになったものの、情報が不足していたので実際に僕が行なった設定を書いておく。
設定手順
2 段階認証を有効化する
下記の Github のセキュリティページより有効化。 簡単なので説明は不要でしょう。MFA か SMS 認証かを選べます。
Personal access tokens を発行する
下記の Github のアクセストークンページより新規トークンを作成。
repo から gist までを全てチェックの上 Generate token。
表示されるトークンは一度きりなので必ずどこかに保存。
接続確認
Terminal から下記コマンドを実行し、クレデンシャル情報をリセットする。
git credential-osxkeychain erase host=github.com protocol=https
次に先ほど保存したトークンを用いて適当な自身のプライベートリポジトリをクローン。
git clone https://github.com/hoge/fuga.git Cloning into 'fuga'... Username for 'https://github.com': your-username Password for 'https://hoge@github.com': your-token