LoginSignup
0
0

More than 1 year has passed since last update.

GitHubからpullすると認証エラーが出るようになった。

Last updated at Posted at 2021-06-30

発生した問題

ローカル環境のコマンドライン(bash)からいつものようにGitHubプライベートリポジトリに対してgit pullを行ったところ、以下の認証エラーが突然出るようになった。

remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead.
remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information.
fatal: unable to access 'https://xxxx@github.com/xxxx/xxxx.git/': The requested URL returned error: 403

どうやらこれまでのようなパスワード認証から二段階認証やパーソナルアクセストークンとやらを使った認証を利用しないとコマンドラインからGitHubリポジトリにアクセスできなくなる模様。

後掲の参考サイトに記載のあるように、確かにGitHubより忠告のメールが来てた気がする。。

選択した解決策

GitHubよりパーソナルトークンを発行し、ローカルからの認証にパーソナルトークンを利用するように設定する。

パーソナルトークンの発行

以下の公式ドキュメントのとおりに発行。
https://docs.github.com/ja/enterprise-server@2.21/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

今回はbashから認証したいので、トークンに付与するスコープはrepoのみを選択。

パーソナルトークンをgitの認証情報として保存

発行したパーソナルトークンをpasswordに設定。
git config --global --add user.password '発行したパーソナルトークン文字列'

パーソナルトークンをキャッシュさせる。
git config credential.helper store

以上でgit pullなどのコマンドが実行できるようになる。

参考にさせていただいた記事

https://qiita.com/kanta_yamaoka/items/1a59892028b9c422df22
https://qiita.com/Kamo123/items/c92b03278b6302c641e3

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0