We've just released Sales Pop, an Easy Digital Downloads extension! View More

Github Updates were rejected because the remote contains work that you do not have locally?

By Sal

You are here because you got the message: Updates were rejected because the remote contains work that you do not have locally. Here are the solutions depending on the context:

1. The repository contains items that are not on your local project

If the repo contains some items that are not there locally, we we need to integrate the remote changes and then push.

First, we’ll pull from the remote:

git pull origin master

Then we push changes to the remote:

git push origin master

2. Push from a local project without git to an existing repository

git init
git add .
git commit -m "my new commit"
git remote add origin yourrepolink.git

yourrepolink.git is the git repository you want to push to

git remote -v

If successful, the response should be: origin yourrepo.git

git push origin master

Not working? If you get the Updates were rejected because the remote contains work that you do not have locally message, force it only if you do not worry about re-writing the repository!

git push -f origin master 
Share