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