LoginSignup
3
2

More than 1 year has passed since last update.

git clone 〇〇 が上手くできない時の対処法 〜 Authentication failed for 'https://github.com〇〇 〜

Last updated at Posted at 2022-01-20

はじめに

こちら自分用のメモであるためとても雑な記事です。
ただ、同じようなエラーが出た人の助けに少しでもなれば幸いです。

エラーログ

Username for 'https://github.com':〇〇
Password for 'https://〇〇-user@github.com':〇〇
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/〇〇-user/repository-name.git/

原因

2021/8/31以降よりGithubのポリシーが変更され、従来のパスワード認証によるHTTPSアクセスができなくなった

解決策

個人アクセストークンいわゆるPAT(Private Access Token)を作成し、パスワードを打ち込む代わりにこれを指定する。

環境

macOS Monterey 12.1
スクリーンショット 2022-01-21 23.00.47.png
スクリーンショット 2022-01-21 23.00.34.png

1. PAT(Private Access Token)を作成する

下記リンクのGitHub公式ドキュメントを参考にPATを作成します。

⚠️ ブラウザを閉じてしまうと先ほど作成したPATは再生成する必要が生じるので忘れずにコピーしておきましょう

2. パスワードの欄に先ほど作成したPATを設定する

再挑戦!

$ git clone 〇〇
Username for 'https://github.com': GitHubのユーザー名
Password for 'https://xxxxx@github.com':  先ほど作成したPATを入力する!!

いかがでしたでしょうか!?
少しでもエラー解決の助けになっていれば幸いです!

3
2
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
3
2