Answer the question
In order to leave comments, you need to log in
What's wrong with push in Git?
Hello! I'm learning Git, when I push to the server, I get this error, what does it mean?
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/...'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Answer the question
In order to leave comments, you need to log in
git init
not needed if later used git clone
.
The error is due to the fact that the server has changes that you do not have in the local repository.
Must be done git pull
before git push
.
...another option is to use the --force (-f) option - it ignores this error in particular...
Need to do git pull before git push. This is a really working one!!!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question