1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHubを使おうとしたらfatal: Authentication failed for~のエラーが出たのでその対処法

Posted at

エラーが出た背景

GitHubを使おうとしたらfatal:Authentication failed for~というエラーが出たのでその対処方法を書きます。

そもそもの原因

GitHubではアカウントの安全性を保つためにパスワード認証でのGit操作を廃止してトークン認証でのGit操作に変更しています。

↑GitHubブログのGit操作のトークン認証要件より

なのでトークン認証に切り替える必要があります。

解決方法

この記事を参考に解決しました
Personal access tokens (classic)の登録をすると解決できます。
その手順を紹介します。

Personal access tokens (classic)を作る

まずSettingsに移動する

GitHubにログインしてもらって右上にある自分のアイコンを押します。
メニューの下の方にあるSettingsというボタンを押します。

Personal access tokens (classic)に移動する

Settingsを押すと左側に Personal access tokensのボタンがあると思うので、
そこからTokens (classic)を押します。

実際にPersonal access tokens (classic)を作っていく

Tokens (classic)のボタンを押すと、Generate new token のボタンがあると思うので、その中のGenerate new token (classic)を押します。
その後認証が必要になるので認証を完了してください。
その後Note,Expiration,Select scopesを記入し、
Generate tokenを押してください。

トークンを保存する

Generate tokenを押すと実際にトークンが発行されます。
トークンがコピーできると思うので、コピーしてどこかに保存しておきましょう。

これで認証用のトークンを作ることができました。

実際に使ってみる

terminal

git push 

などをしてみると

GitHubのUsernameとさっき作ったトークンをPasswordのところに入力するとpushができます。

これでGitHubが使えるようになります。

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?