LoginSignup
26
12

More than 1 year has passed since last update.

【Windows】Gitでリモートにアクセスができない時の解決方法(Support for password authentication was removed on August 13, 2021.)

Posted at

事象

SourcetreeなどでGitHubにpullやpushしようとすると、以下のエラーが表示されました。

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jw-sd-dev/DocumentManagementSystem.git/'

原因

2021年8月13日からGitにローカルからGitにアクセスするためには、これまでのパスワードではアクセスできなくなりました。
その対応として、以降はアクセストークンと呼ばれるパスワードのようなモノを発行する必要があります。

解決方法

自分がやったことを手順として残しておきます。

1.gitにログイン

下記URLから、自分のgitにログインする。
https://github.com/login

2.Settingsを開く

右上のアイコンからメニューを開き、Settingsを選択する。

image.png

3.Developer settingsを開く

Developer settingsをクリック

image.png

4.Personal access tokensを開く

Personal access tokensをクリック

image.png

5.トークンを新しく作成する

Generate new tokenをクリック
※パスワードが聞かれたらgitのパスワードを入力する

image.png

6.New personal access tokenの発行画面になるため、以下入力&選択を行う。

Note:任意の名称を入れてください。
Expiration:何日の有効にするかを決めてください。(悩むなら30日でいいです)

image.png

Select scopes:repoと、admin:repoとdelete:repoは必須でチェックを入れる
image.png

7.トークン作成

設定が終わったら「generate token」を押してアクセスコードを発行する。
image.png

8.トークンをコピー

作成したトークンをコピーする
アクセストークン.png

9.コントロールパネルを開く

検索窓などからコントロールパネルを開く

10.ユーザーアカウントを開く

コントロール パネル > すべてのコントロール パネル項目 から ユーザーアカウントをクリック

image.png

11.資格情報の管理を開く

左上の資格情報の管理をクリック

image.png

12.Windows 資格情報を選択し、git:https://github.com を開く

Windows 資格情報 をクリックし、git:https://github.com をクリック

image.png

13.編集画面からパスワードを手順8でコピーしたアクセストークンに変更し保存する

編集をクリックし下記画面が表示されたら、パスワードをアクセストークンに変更し保存する。

image.png

まとめ

以上で手順は完了なので、gitとコントロールパネルは閉じてOKです。
gitのリモートに接続できるか確認してみてください。

26
12
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
26
12