I\'m trying to push my project (all files in a new repository). I follow the steps but when I push with git push -u origin master
I get this error:
This is because you have made conflicting changes to its master. And your repository server is not able to tell you that with these words, so it gives this error because it is not a matter of him deal with these conflicts for you, so he asks you to do it by itself. As ?
1- git pull
This will merge your code from your repository to your code of your site master.
So conflicts are shown.
2- treat these manualemente conflicts.
3-
git push origin master
And presto, your problem has been resolved.
NOTICE: This is never a recommended use of git. This will overwrite changes on the remote. Only do this if you know 100% that your local changes should be pushed to the remote master.
Try this: git push -f origin master
! [rejected] master -> master (non-fast-forward)
Don’t panic, this is extremely easy to fix. All you have to do is issue a pull and your branch will be fast-forward:
$ git pull myrepo master
Then retry your push and everything should be fine:
$ git push github master
This happened to me when I was on develop branch and my master branch is not with latest update.
So when I tried to git push from develop branch I had that error.
I fixed it by switching to master branch, git pull, then go back to develop branch and git push.
$ git fetch && git checkout master
$ git pull
$ git fetch && git checkout develop
$ git push