やりたいこと
GitHubにリポジトリを作って、ローカルからpushしたい。
状況
…or push an existing repository from the command line git remote add origin git@github.com:kotakanazawa/write-everyday.git git branch -M main git push -u origin main
方法
ローカルのブランチ名をmainに変更
まずはローカルのブランチ名を変更する。
git branch -m master main
コミットを積む
git add . git commit -m 'first commit'
登録
git remote add origin git@github.com:kotakanazawa/write-everyday.git git branch -M main git push -u origin main
デフォルトブランチ名をmainに変える
毎回masterをmainに変更するのは面倒。そこでデフォルトブランチ名をmainにしてしまう。
git config --global init.defaultBranch main