Working on a git repository and I merged my new branch with the master branch locally. Now I want to push this merge to the git server but I am getting an error: Update was rejected because the update contains work that you do not have locally. This is usually caused by another reppository pushing to the same ref.
Asked
Active
Viewed 765 times
0
-
2Before merging master locally, you should have pulled master to get the latest change if any. Someone else may have pushed to master. Could you try taking a git pull, resolve conflicts if any and then try pushing ? – vishnu narayanan Feb 20 '20 at 02:28
-
you need to pull the latest changes from master (origin/remote) to you master local. Resolve any potential conflicts and push from local to remote master – blurfus Feb 20 '20 at 02:28
-
1Error says that origin repository contains some changes, so you have to pull first and then resolve conflict if any then push – Abhay Sehgal Feb 20 '20 at 02:28
-
Does this answer your question? [git: updates were rejected because the remote contains work that you do not have locally](https://stackoverflow.com/questions/24357108/git-updates-were-rejected-because-the-remote-contains-work-that-you-do-not-have) – phd Feb 20 '20 at 11:06
1 Answers
0
This is a really common error faced by many people out here so it is not a big issue. You just need to do a git pull
, which will merge changes made on the remote(i.e the GitHub/BitBucket/GitLab repository) while you were working on your code.
After that you can git push
to push your changes upstream :)
Best.

rasengan__
- 883
- 8
- 16