Pushing an existing project to a new repo on github

When creating a new repository on github, you want to be sure to NOT initialize it with a README. Otherwise, when you push your existing repo, you will get errors which will require you to do a force push that can create problems later on.

So just make sure to keep the README checkbox unchecked.

empty repo

Then initialize your project in case it isn’t.

git init

Add all the files in the folder

git add .

Commit them

git commit -m "initial commit"

Connect the project to remote repo on github

git remote add origin https://github.com/user/repo.git

And finally push all the changes and files

git push origin master