Github-Updates were rejected because the remote contains work that you do not have -how to push my work to git hub

720    Asked by DanielBAKER in Devops , Asked on Jun 15, 2021

 I created a new repo, cloned it, added files to the directory, added them with add -A, committed changes, and when I try to push using git push master I get 

"Updates were rejected because the remote contains work that you do not have".

This doesn't seem to make sense since it's a new repo and contains only a readme file.

Answered by anu rhea

The hint: updates were rejected because the remote contains work that you do error occurs if you initialize a new git-hub repository so to resolve this issue you need to add the remote and pull the changes again for that use the following commands.

git remote add origin [//your github url]
git pull origin master
git push origin master

Your Answer

Interviews

Parent Categories