hint: Updates were rejected because the remote contains work that you do To XXX

his error reported when using webstorm or idea push code

The reason is to manually create git and specify the remote project

Open Terminal

git init # Initialize the local warehouse
git remote -v # View the associated warehouse address
git remote add origin https://gitee.com/xjseo/personnel-management.git # Add remote warehouse address

Then restart the editor and it will appear in the upper right corner

Then click the checkmark commit to submit all the code to the temporary storage,

Then click the third arrow to push

Will be fail to push

Checking the git log will find the following errors:

error: failed to push some refs to 'https://gitee.com/xjseo/personnel-management.git'
hint: Updates were rejected because the remote contains work that you do
To https://gitee.com/xjseo/personnel-management.git
hint: not have locally. This is usually caused by another repository pushing
!    refs/heads/master:refs/heads/master    [rejected] (fetch first)
Done
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.

The general idea is that you should pull the warehouse code and synchronize the local code.

So then click the first one to pull the following and then click the third push to succeed.

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *