git push error: error: failed to push some refs to'[email protected]:xxx/xxx.git'

Error when git push:

error: failed to push some refs to '[email protected]:xxx/xxx.git'

Today, when I pushed the local warehouse to the remote warehouse, an error was reported. . .
That's it:

Insert picture description here

Or, using git gui, the usage is like this:

Pushing to git@github.com:************.git
To github.com:************.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '************.git'
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.

 
  
  
 
I checked several solutions and none of them worked, and finally found that the README.md file in github was not in the local code directory.

I checked it and it turned out to be true!

This time by git pull --rebase origin master the README.md cloned into the local library.

 
  
 

After that, you can see that there is a README.md file in the local warehouse ~~

 
  
  
 
Until then executed git push origin masterto complete the upload operation to a remote repository
Insert picture description here

Or use git gui to implement push:

At last:

参考:
(1):https://blog.csdn.net/qq_34842671/article/details/70916587
(2):https://blog.csdn.net/sinat_34937826/article/details/90512627

Guess you like

Origin blog.csdn.net/qq_41709378/article/details/107435985