git rejected push non-fast-forward

Try doing

git pull origin master
git add -A
git commit -m "modified code"
git push origin master

Your local repository is likely out of sync with the remote repository.


There are changes in the central repository that you must pull before you can push. Do

git add -A
git commit -m "my local changes" 
git pull

Resolve any conflicts. Then do

git push

Alternatively, if you have no valuable modifications locally, you can create a new clone of your repo, and start working from there:

git clone https://[email protected]/johnsproject/proj.git new_repo_dir