Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: failed to push some refs although I have done git pull

Tags:

I started to get 'failed to push some refs' error when I changed some files and tried to do push. Most instructions tell to do git pull first. I have done it and git says everything is up to date. Any idea how to solve the error? I also started getting 'no version information available' message, I don't know does that have anything to do with the error.

git push origin master git: /usr/local/lib/libz.so.1: no version information available (required by git) Enter passphrase for key '/root/.ssh/id_rsa':  To git@[mydomain].beanstalkapp.com:/repo-git.git ! [rejected]        master -> master (non-fast forward) error: failed to push some refs to 'git@[mydomain].beanstalkapp.com:/repo-git.git' 
like image 221
jjei Avatar asked Aug 29 '11 10:08

jjei


People also ask

How do I fix failed to push some refs to git errors?

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.

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>

Can not push refs to remote Try running pull first to integrate your changes?

One possible reason that you get the "Failed to push some refs" error is that you do not have enough permission to push to the current branch (probably master). You need to ask project maintainers to give you enough permission or you need to push your changes to another branch and make a merge/pull request.


1 Answers

The error is that somebody else has pushed in the master branch and you would overwrite their change if git allowed you to push (this is what non-fast forward error means). So you need to merge your local master branch with the remote master branch.

This can happen if you did the git pull while the local branch was not the master branch. If you only want to push the branch you are working on and not the master branch, you need to tell it to git using the complete form of git-push:

$ git push remote local-branch:remote-branch 
like image 60
Sylvain Defresne Avatar answered Oct 26 '22 18:10

Sylvain Defresne