2
2

More than 3 years have passed since last update.

SourcetreeのGitHub パスワードをパーソナルアクセストークンに変更する方法

Last updated at Posted at 2021-08-15

現象

Githubにpushできない

以下、エラー内容

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: unable to access 'https://github.com/<ユーザ名>/<リポジトリ名>.git/': The requested URL returned error: 403

エラー原因については以下の記事を参照

解決策

01.png
1.GitHub で SettingsDeveloper settingsPersonal access tokensGenerate new token を開く

02.png
2.必要な権限にチェックを入れ、 Generate token をクリック(迷ったらすべてチェックしてOK)
※ 再確認できないためtokenはメモ必須
03.png
04.png
3.コントロール パネルユーザー アカウント資格情報マネージャーWindows資格情報 を開く
4.汎用資格情報の github.com または Sourcetree が付いてるものを削除
05.png
5.C:\Users\ユーザ名\AppData\Local\Atlassian\SourceTree 内の下記ファイルを削除

  • bookmarks.xml
  • opentabs.xml
  • passwd
  • userhosts

06.png
6.C:\Users\ryome\AppData\Local\Atlassian\SourceTree.exe<ランダム文字列>/<version>/ 内の下記ファイルを削除

  • user.config

07.png
7.Sourcetree を起動し、 Add からローカルリポジトリを選択する
08.png
8.プッシュ時に ユーザー名2で取得したtoken を入力する
9.プッシュが成功すれば解決

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