I'm trying to push my code to my remote branch but keep receiving this error:
! [rejected] (non-fast-forward)
error: failed to push some refs to '[email protected]:
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details
I think what may have caused this was the fact that I fixed a typo in my README.md on github instead of through my local environment.
I've looked all over stack overflow and tried the commands they mentioned for this problem such as git pull
, git pull --rebase
, git pull origin master
, git push --f
and many others with no avail.
I've also tried the answers in the following questions, with no success:
Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g [duplicate]
Cannot push to GitHub - keeps saying need merge
Git pull a certain branch from GitHub
I also tried git pull upstream master
and I get this error:
fatal: 'upstream' 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.
Problem resolved:
I added another change and saved it in my local environment and did the following:
git stash
git pull origin <branch-name> -v
git add .
git commit
git push origin <branch-name>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With