LoginSignup
0
0

More than 1 year has passed since last update.

GitHubにpushできなくなった ~トークン生成で解決~

Posted at

はじめに

久しぶりにローカルからGitHubにpushしたらエラーが吐かれた。
その際の解決方法について今回まとめることにしました。

エラー

ターミナル
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: Authentication failed for 'https://github.com/リポジトリ名.git/'

エラー文を見ると、2021年8月13日にパスワード認証が廃止されたと記載されていた。
言われてみれば、1ヶ月前くらいにGitHubにアクセスするにパスワード認証が変更あったなと思い出した:sweat:

ターミナル
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.

要員

2021年8月13日からパスワード認証が廃止__

今まではローカルでGitHubにアクセスするにパスワード認証を使用しておりましたが、脆弱性防止のために個人アクセストークン認証に変更。

<従来>
・GitHub ユーザー名
・GitHub メールアドレス
・GitHub パスワード

<従来>
・GitHub ユーザー名
・GitHub メールアドレス
・GitHub 個人アクセストークン

GitHubの個人アクセストークン作成方法

1.下記に個人アクセストークンを生成する手順が記載に沿って進めてください。

1.個人アクセストークンが生成後、トークンをコピーする。

※セキュリティ上の理由から、ページから移動した後は、トークンを再表示できないので注意する。

スクリーンショット 2021-09-17 21.06.04.png

GitHubとローカルの連携

ユーザー名登録

ターミナル
$ git config --global user.name GitHubに登録のユーザー名

メールアドレス登録

ターミナル
$ git config --global user.email GitHubに登録のメールアドレス

GitHubにプッシュ

ターミナル
$ git push origin main

パスワード入力が求められるので、先ほど控えた個人アクセストークンを入力

スクリーンショット 2021-09-17 21.06.04.png

無事、プッシュ達成!

エラー文に記載してあったので今回はすんなりと解決できてよかったです!!!

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