When we found a problem in the Github repository, you changed it online on Github; Or you can just add a README file or something to a library on Github without synchronizing it. Push fails when you have a commit again to commit from the local library to the remote Github library.
I edited a file online in github library, and it was not synchronized to the local library. After that, I added the file test.txt in the local library and tried to submit it to github, but the following error occurred: error: failed to push some refs to.
A statement in advance
For the code lost in the comments, it should be emphasized again that the base should be used with caution, and the branch should be determined before operation. In this case, the master branch is taken as an example, and the loss of the code caused by the wrong branch should be taken as the consequence.
The problem is that the remote library is inconsistent with the local library, so we can just synchronize the remote library to the local library. Note: I use the master branch here, please change the branch according to your own development branch.
git pull --rebase origin master
This directive merges updates from the remote library into the local library – the rebase function is to cancel the commit from the local library and connect them to the updated version library.
The following is a graphical explanation of the occurrence and resolution of the error situation
git pull –rebase origin master means to cancel commit records, temporarily save them as patches (in the “.git/rebase” directory), synchronize the remote repository to the local repository, and finally merge the patches into the local repository.
will then be able to push the local library into the remote library.
- error: src refspec master does not match any error:failed to push some refs to ‘[email protected]:xxxx
- You are not allowed to upload merges in Git push
- [Git & GitHub] Solution: error: failed to push some refs to’https://github.com/xxxx.git’
- Git failed to submit data error: failed to push some refs to’https://github.com/XXXXXXX/gif.git’
- Solve github :error: failed to push some refs to problem
- Git push you are not allowed to upload merges
- Error: failed to push some refs to ‘xxx’
- How to Fix GIT Push Error
- Failed to push some refs to
- [Git] git pull pull remote git push to remote git commit submit reject
- Please specify which branch you want to merge with
- GitHub upload failed: git push error: failed to push some refs to exception handling
- Git uploads local IntelliJ idea project to GitHub
- pathspec ‘master’ did not match any files known to git
- error: src refspec master does not match anyerror: failed to push some refs to
- Git did not exit cleanly (exit code 128)
- Error: You have not concluded your merge (MERGE_HEAD exists)
- Git solves pull origin error: the following untracked working tree files would be rewritten by merge
- Pull is not possible because you have unmerged files. Please, fix them up in the work tree, and then