gitにpushする

git init

Reinitialized existing Git repository というメッセージが表示されました。
そしてgit関連のファイルが同じディレクトリに作成されたぽいです。

空のcommitしてみる

git commit --allow-empty -m "first commit"
Committer: 本名 <本名のMacBook-ea.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

なんか色々表示されたんだけどusernameとuseremailを自動的に設定しましたというメッセージですかね。

変えようと思ったんですが、後で混乱しないようにデフォルトのままにしておきます。

そしてリモート側にリポジトリを作成。ぽちぽち。人に見せるわけでもないのでprivateにしておきます。

ローカルとリモートをつなぎます。

git remote add origin git@github.com:{user name}/{repository name}.git

できているか確認。

git remote add origin git@github.com:{user name}/{repository name}.git

やべ、そもそもssh全く設定してなかった。
.sshディクトリすらも無いという笑

これを参考に設定します。

ではpushしますか〜〜


てあれ、うまくいかん…


なんかローカルとリモートで比較ができないとかなんとかでうまくPRを作成できず。


色々試しましたが以下でうまくいきました

git push origin main -f 

ローカルの内容で全て書き換えます!という強制的な呪文ですw


最初なのでこれで問題ないでしょう。


お疲れさまでした!


この記事が気に入ったらサポートをしてみませんか?