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.
- GitHub upload failed: git push error: failed to push some refs to exception handling
- Git failed to submit data error: failed to push some refs to’https://github.com/XXXXXXX/gif.git’
- [Git & GitHub] Solution: error: failed to push some refs to’https://github.com/xxxx.git’
- How to solve error: failed to push some refs to ‘[email protected]:……git pull conflict
- Solve github :error: failed to push some refs to problem
- Error: failed to push some refs to ‘xxx’
- error: src refspec master does not match any error:failed to push some refs to ‘[email protected]:xxxx
- Failed to push some refs to
- error: src refspec master does not match anyerror: failed to push some refs to
- Git push you are not allowed to upload merges
- You are not allowed to upload merges in Git push
- How to Fix GIT Push Error
- Error: SRC refspec master does not match any. error: failed to push some refs to
- [Git] git pull pull remote git push to remote git commit submit reject
- Git push “fatal: Authentication failed ”
- [FAQ] after git merge, the push to Gerrit fails, indicating no new changes?
- The solution of push D command execution error (/ bin / sh: 1: push D: not found) on Ubuntu
- Git push failed, prompt unpack error / unpack failed solution
- Error report after solving git push origin master