[git error]: git push prompt error: failed to push some refs to “xxxxxx”

1. Problem description

When submitting a file to the remote library during the git push operation, an error is reported: error: failed to push some refs to 'https://gitee.com/gitee-zhangchq/stm32.git'
Translation:

Error: Unable to push some refs to 'https://gitee.com/gitee-zhangchq/stm32.git'

Insert image description here

2. Cause of error

Since this is a newly created remote library on gitee, and when creating the remote library, I also chose to automatically generate the readme document. At this time, there are two files in the remote library: README.en.md README.md. However,
in Locally, I directly create a directory, git init initializes a local library, and then adds a folder document to download a Chinese document. At this time, the local one lacks the two files README.en.md and README.md of the remote library, so An error will be reported when git push;

3. Problem solving

The reason for this error is that the local library lacks some files in the remote library. At this time, just synchronize the remote library to the local library and then submit it: use the command
:

git pull --rebase stm32 master //stm32 is the remote library name and master is the remote library branch

Insert image description here
After rebase, push again is successful:
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_42640280/article/details/127354978