2021年8月からhttpsのlocalでpushできなくなった(パスワードでアクセルできない)ので
変更点と新しいgit pushの仕方を説明します。
先にファイルに入れたアプリを作成しておきます。
githubでレポジトリを作成します。
httpsとsshがありますがhttpsのままで大丈夫です。
次にホーム画面の右上のマイアイコンからsettingを選びます。
developer settingを選び、personal access tokenを選びます。
名前をmytoken20221010などとしておき、
setting optionでrepoだけを選ぶ。
入力が完了したら、generate tokenをクリック
tokenが発行されたらコピーして控えておきます。
それからコマンドラインでcd test-appのようにアプリまで場所を移動して
git init
git add .
git commit -m "first commit"
it remote add origin https://github.com/githubのユーザ名/アプリ名.git
git branch -M main
git push -u origin main
これをコマンドラインで入力し終えたら、githubのユーザ名とパスワードが訊かれます。
githubのユーザー名はそのまま入力して構いません、
パスワードはgithubのではなく先ほどコピーして控えておいたtokenを貼り付け入力します。
これでgithubにアプリをpushできました。
参考にしたサイト