Problem Description
git push
The following problem occurred when
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.
Solution
First git pull
, the specific process is the following steps:
$ git pull origin master
$ git push origin master
At the git pull
time, you may encounter the following situations:
You can ignore it ( steps 3 and 4 directly below ), but if you want to enter an explanation, you need:
-
Press the keyboard letter i to enter the insert mode
-
Modify the top row of yellow merge information, you don't need to modify it
-
Press "Esc" in the upper left corner of the keyboard
-
Type ":wq", pay attention to the colon+wq, and press Enter