【github】patの期限切れでpull,push等ができなくなった時の対処法

qlog公式からのメッセージ:ログインをしていなくてもいいねを押すことができます!

以下のようなエラーが出た時の対処法を紹介します。

Password for 'https://ghp_*******@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-g             it/about-remote-repositories#cloning-with-https-urls for information on currentl             y recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/{ username }/***.git'

patとは?

コマンド ラインまたは API を使って GitHub への認証を行うときに、パスワードの代わりに personal access token を使うことができます。

参考文献:個人用アクセス トークンを管理する

github上にて再度patを作成し、

git remote set-url origin https://{your_username }:{ token }@{ project_url }

をすると更新され再びgitが扱えるようになります。

your_usernameにはあなたのユーザー名を
tokenはおそらく、ghp_から始まるトークンを使用し
project_urlには扱うプロジェクトの.gitを含まないurlを記述してください。


yusa