Error: failed to push some refs to ‘xxx’

modified part of the project today, and then pushed origin master to the remote warehouse with git, the following error was reported:

error: failed to push some refs to 'https://github.com/ZJyoung1997/JZShop.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.

The reason is that the files in the remote warehouse are different from our local warehouse. For example, your remote warehouse has a file readme.md, but the local warehouse does not. mine is caused by having the readme.md file in the remote warehouse and not having it in the local warehouse. In addition, I usually use the association's computer to develop, and then use my own computer to develop after I return to the dormitory, which may also be the cause of this problem. In this case, the solution would be to clone the local repository directly and then clone it from the remote repository, but this would be too cumbersome, and the branch merge method

could be used

solution:
git pull --rebase origin master

The

git pull command is used to get and integrate (consolidate) from another repository or local branch, fetch updates to a branch on the remote host, and merge with the local specified branch.

if the following error is reported, you can also use the git pull command

fatal: 'master' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

with git pull origin master - allow - unrelated - nothing solution

Read More: