add github remote to existing repo code example

Example 1: git set remote

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

Example 2: git add remote

git remote add heroku https://git.heroku.com/arrecs.git
git remote -v
-> heroku	https://git.heroku.com/arrecs.git (fetch)
-> heroku	https://git.heroku.com/arrecs.git (push)

git remote remove heroku
git remote -v

Example 3: git push existing code to new repository

git remote add origin <remote repository URL>

Example 4: how to upload existing project to github

git remote add origin remote repository URL
git remote -v
git push -f origin master