create remote git repository from local code example

Example 1: git push new repo to remote

$ git remote add origin <remote repository URL>
# Sets the new remote

# Push the changes in your local repository to GitHub.
$ git push -u origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin

Example 2: create a git repository from local machine and push it online

#initialize 
git init 
# add your URL , it can be local or remote one 
git remote add origin <YOUR_URL>
# commit something
git add *
git commit -m "your message"
# push to your repository 
git push origin master
# you can then go and check online