0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SourceTreeで、Personal Access Tokenの設定方法

Last updated at Posted at 2025-01-26

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v origin develop:develop
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.

このようなエラーが出ることありますよね。

これは2021年でGitHubのパスワード認証が廃止されたため、Personal Access Tokenを使う必要があります。

1.Personal Access Token(PAT)の生成をします
GitHubのウェブサイトにアクセスし、右上のプロフィールアイコンをクリックして「Settings」を選択します。
左側にいろんな選択肢があって、一番下にDeveloper settingsというのを選択します
左側の「Personal access tokens」の「Tokens(classic)」を選択します
真ん中の「Generate new token」の「Generate new token(classic)」を選択します

Noteは名前なので、わかりやすい名前で設定します。
Expirationは期限です。これはお好みです。期限になったらまたTokenをしなければなりせん。
Select scopesの中のrepoとuserにチェックに入れます。
そして、一番下のGenerate tokenを選択します。
そしたら、真ん中にTokenが出現します。それをコピーします。

2.SourceTreeでの設定
SourceTreeの右上に設定を選択します。
リモートの中のリモートリポジトリパスのパスを編集します。

https://<USERNAME>:<TOKEN>@github.com/<USERNAME>/<REPOSITORY>.git <USERNAME>: GitHubのユーザー名 <TOKEN>: 上記で生成したPAT <REPOSITORY>: 

これで保存すれば大丈夫です。
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?