Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
3 views
in DevOps and Agile by (29.3k points)

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 <repo name> 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.

1 Answer

0 votes
by (50.2k points)

This 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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...