近頃Githubから急に怒られるらしい

何が起きている?

そもそもこれはなんだということで、 https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations にアクセスしてgithubのブログへ。

Beginning August 13, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.

なるほど、去年から「来年8月13日でパスワードでアクセス(コマンドラインやアプリでgithubにアクセスすることを)させなくするよー」とは言ってたと。 ただ2要素認証を事前にしていればこの影響は受けないみたいです。 というのも、2要素認証をしている場合はhttpsのパスワードにトークンをセットする必要があるためです。

The following customers remain unaffected by this change: If you have two-factor authentication enabled for your account, you are already required to use token- or SSH-based authentication.

で、そもそもなぜこれをしたのかというのが

Despite these improvements, for historical reasons customers without two-factor authentication enabled have been able to continue to authenticate Git and API operations using only their GitHub username and password.

前文は省いていますが、要は二要素認証などで優れたセキュリティ対策が行えるにもかかわらず、 その設定を行わないアカウントはパスワードでgitを操作できてしまっていたというのが問題だったよう。

ではどうするか

下記記事を参考にmacのキーチェーンアクセスを変更すると解決するみたいですね。 (パスワードではなく発行したトークンを使用するようにする) https://zenn.dev/suzuki_hoge/articles/2021-08-github-access-f732e5b9868137

結論

せっかくだし二要素認証を設定しましょう