updates were rejected because the remote contains code example

Example 1: Updates were rejected because the remote contains work that you do

git pull origin master
git push -u origin master

Example 2: updates were rejected because the remote contains work that you do

git remote add origin [//your github url]

//pull those changes

git pull origin master 

// or optionally, 'git pull origin master --allow-unrelated-histories' if you have initialized repo in github and also committed locally

//now, push your work to your new repo

git push origin master



Credit to palerdot's answer on this post:
https://stackoverflow.com/questions/18328800/github-updates-were-rejected-because-the-remote-contains-work-that-you-do-not-h