Today, I modified a part of the project, and then used
git push origin master The following errors are reported when pushing to the remote warehouse:
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. This may happen. My problem is that there is a readme. MD file in the remote warehouse, but there is no such file in the local warehouse. There is also because usually in the association, they use the association’s computer to develop, and when they return to their bedroom, they will use their own computer to develop, which may also be the reason for this problem. There is a solution to this situation, which is to directly kill the local warehouse and then re-clone it from the remote clone. However, this is obviously too troublesome. You can use the method of merging branches
git pull --rebase origin master
The GIT pull command is used to obtain and integrate (consolidate) from another repository or local branch, retrieve the update of a branch of the remote host, and then merge with the specified branch of the local host.
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.
git pull origin master --allow-unrelated-histories to solve this error.
- How to Solve error: failed to push some refs to ‘xxxx’
- Git Push hint: Updates were rejected because the remote contains work that you do hint: not have …
- [Solved] gitee Push Error: error: failed to push some refs to
- How to Solve Error: failed to push some refs to git
- Git | fatal: refusing to merge unrelated histories [How to Solve]
- Git Push Error: rejected error: failed to push some refs to… [How to Solve]
- error: src refspec master does not match any [How to Solve]
- [Solved] Git pull fatal: refusing to merge unrelated histories
- Git Pull Error: Please specify which branch you want to merge with.