Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub - error: failed to push some refs to '[email protected]:myrepo.git'

I am getting the following error. How do I resolve?: git add . git commit -m 't' git push origin development

To [email protected]:myrepo.git  ! [rejected]        development -> development (non-fast-forward) error: failed to push some refs to '[email protected]:myrepo.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. 'git pull') before pushing again.  See the 'Note about fast-forwards' section of 'git push --help' for details. 
like image 614
Tampa Avatar asked May 25 '12 11:05

Tampa


People also ask

How do I fix failed to push some refs to GitHub?

How to Fix error: failed to push some refs to Error in Git Using git pull. To send a pull request means to "fetch" new changes made to the remote repo and merge them with the local repo. Once the merging is done, you can then push your own code changes to GitHub.

How do I fix failed to push some refs to Origin?

To fix this issue, run git pull on your local repository. This should allow you to push to origin again.

What does failed to push some refs mean?

This means that someone else pushed a commit to the same branch you're pushing to, but you don't have that commit on your laptop yet. This can happen if it has been awhile since you ran "git pull" on a branch that many people contribute to, such as staging. To fix this issue, run: git pull origin <your-branch>


1 Answers

Your origin repository is ahead of your local repository. You'll need to pull down changes from the origin repository as follows before you can push. This can be executed between your commit and push.

git pull origin development 

development refers to the branch you want to pull from. If you want to pull from master branch then type this one.

git pull origin master 
like image 125
Dan Lister Avatar answered Sep 20 '22 13:09

Dan Lister