目的
2021/8/14サーバにてGitHubからpullを行ったところ、エラーとなった。
# git pull
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'xxx': The requested URL returned error: 403
ああ、そういえばと、以前から何度もGitHubから以下の警告があったが、ついにパスワード認証が使えなくなったんだなと。
※8/13に使えなくなったよう。
You recently used a password to access the repository at xxx with git using git/2.20.1.
Basic authentication using a password to Git is deprecated and will soon no longer work.
ということで、この記事はその対処方法
参照サイト
Token authentication requirements for Git operations
Creating a personal access token
2つ目のGitHubページは日本語表示も可能です。
対応メモ
GitHubにアクセスして、アイコンメニューのSettings
より、Developer settings
をクリックする。
Personal access tokens
をクリックする。
Generate new token
をクリック後、New personal access token
ページより設定する。
- Noteをトークンの役目とかを適切に
- Expiirationを設定する。期限なしも設定できる。
- Select scopesは適切に。自分はrepoを選択した。
No expiration
とすると警告が表示されるが。
設定後、画面したのGenerate token
ボタンをクリック。
これで完了。
画面にパーソナルアクセストークンが表示されるので、コピーする。
使い方としては、今までユーザパスワードを設定していた部分に上記のパーソナルアクセストークンを設定する。
//以下のtoken部分にpersonal access tokenを
https://username:token@github.com....
以上です。