Git, invented in 2005. Programmers on 2004:

https://lemmy.eco.br/post/11724141

Git, invented in 2005. Programmers on 2004: - Brasil

Lemmy

this guy would have force pushed onto main about 10 mins after this
Tbf you have to do that for the first push, if a Readme file way autogenerated
You don’t if you just clone the repo you created.
Huh? I’m talking about existing code being in a dir, then initting a git repo there, creating a pendant on your hoster of choice and then pushing it there. Wouldn’t cloning the repo from step 3 to the code from step 1 overwrite the contents there?
If your remote is completely empty and has no commits, you can just push normally. If it has an auto-generated “initial commit” (pretty sure Github does something like that), you could force push, or merge your local branch into the remote branch and push normally. I think cloning the repo and copying the contents of your local repo into it is the worst option: you’ll lose all local commits.