How to git push an existing project to online repository (GitHub, Bitbucket ...)

1 September 2022

Command line steps needed to push any existing project to git repository

Follow these steps:

git init
git add .
git commit -m "Add existing project files to Git"
git remote add origin https://github.com/somebofy/path_to_project.git
git push -u -f origin master

The -u switch makes the remote GitHub repo the default for your existing project.
The -f switch forces Git to overwrite any files that already exist on GitHub with your existing project's files.