LoginSignup
4
11

More than 1 year has passed since last update.

[Github]git push origin master後、password入力後エラー(Authentication failed for~)

Posted at

はじめに

本記事では、git push origin master後、password入力後のエラーについてを記述します。

本題

ターミナルにて

 % git push origin master
Username for 'https://github.com': ユーザー名
Password for 'https://mkato1013@github.com': パスワードを入れてみた
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/ユーザー名/リポジトリ名/'

パスワードは何度入力しても同じだし、
パスワードを変更してみても、だめでした。

結論

2021年8月13日以降、
GitHubのリポジトリにアクセスするには、
ユーザ名とパスワードではなくアクセストークンが必要になったようです。

知らなかった。。。

方法

Githubにログイン後、右上アイコン選択し、Settingsへ。
Image from Gyazo

左下のDeveloper settingsへ。
Image from Gyazo

Personal access tokensからのGenerate new tokenへ。

Image from Gyazo

New personal access tokenへたどり着いたら、
少なくともrepoにチェックをつけます。

その後は、Generate tokenします。

また

トークンは、後で確認することができないので、どこかにメモしておきます。

もう一度

 % git push origin master
Username for 'https://github.com': ユーザー名
Password for 'https://mkato1013@github.com': 先ほどのトークン
Enumerating objects: 113, done.
Counting objects: 100% (113/113), done.
Delta compression using up to 8 threads
Compressing objects: 100% (100/100), done.
Writing objects: 100% (113/113), 27.89 KiB | 4.65 MiB/s, done.
Total 113 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), done.
To https://github.com/ユーザー名/リポジトリ名
 * [new branch]      master -> master

無事に通りました。

以上です。

終わりに

情報は大事ですね。
知らないと痛い目を見る典型例ですね。

以下参考サイトです。
GitHubのリポジトリにアクセス時に「remote: Support for password authentication was removed on August 13, 2021.」エラー
GitHubでパスワード認証が廃止されるので二要素認証とトークン認証の設定方法をまとめた
GitHub、パスワード認証やめるって?

明日も頑張ります!

4
11
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
4
11