When Git tells you it failed to push some refs
April 25, 2008 31 Comments
I received an unhelpful error while trying to push to a repository on Github today:
A JavaScript Architect
April 25, 2008 31 Comments
I received an unhelpful error while trying to push to a repository on Github today:
I ran thegit pull git@github.com:user/repository.gitAnd I’m getting the:”Automatic merge failed; fix conflicts and then commit the result.” π¦ and then, i can’t push >_<'Thanks in advance!
Dammit! XD, I forgot the question man, How are u running the pull command? XD
You need to fix any conflicts, then commit, then push. Run git status to find all files that couldn’t be merged automatically, edit each of them to fix them, then git add . and git commit.You should then be able to git push (though you may have to git pull again first).If you’ve named your origin already you should just be able to run “git pull” without naming the source. If you’re on a branch you may have to type “git pull origin branchname”.
Hi, thank you, I solved my problem setting the core.autocrlf to false!Thanks!
hi – was struggling to find a simple explanation for manual merging conflicts, simple as it is your comment explained it best!
Hey, thanks. Knowing this is sure a lot better than not knowing it!
A life saver. Thanks!
Thanks. I was totally confused.
good job!
It’s not that simple if you then get:You asked me to pull without telling me which branch youwant to merge with, and ‘branch.master.merge’ in
“if you then get:You asked me to pull without telling me which branch you want to merge with”If this happens to you, you need to specify the branch you want to pull. This will normally be master, as in:git pull origin master
Thanks.
Thanks π Short and sweet post π Worked like magic π
These are my favorite blog entries. They come up in the top of a Google search, they are short and sweet, and they work.Rock on.
What more to say? I know I couldn't be disappointed this soon by git. Thanks a million =)
Hi, Thanks. Really helps me but wasted some time without knowing this.
Thank you.
very useful, thank you
When I do the “git pull origin master”, I come up short with this:
fatal: Couldn’t find remote ref master
How can that be?
Thanks for this post. No I think I get it.
That’s a good quick fix for maybe 90% of the cases, but it can cause problems.
Example: I did git-rebase to remove an unwanted commit, and when I tried to push it gave me the error. When I did git-pull to resolve it, the unwanted commit came back. I’m still looking for a solution that actually fixes the originating branch.
I found a deeper explanation of branch conflicts, for those who need it.
http://www.bonsai.com/wiki/howtos/vcs/git_remote_resolve/
Hi,
When I try to push the changes I get the below error message. I’m able to do a clean pull and git status shows no conflicts. Any help will be appreciated. thanks in advance
$ git status
# On branch experimental
nothing to commit (working directory clean)
$ git push ssh://abc@localhost:29418/httpd-2.2.15 HEAD:refs/for/experimental
abc@localhost’s password:
Total 0 (delta 0), reused 0 (delta 0)
To ssh://abc@localhost:29418/httpd-2.2.15
! [remote rejected] HEAD -> refs/for/experimental (no new changes)
error: failed to push some refs to ‘ssh://abc@localhost:29418/httpd-2.2.15’
Then i do:
$ git pull ssh://abc@localhost:29418/httpd-2.2.15
abc@localhost’s password:
From ssh://abc@localhost:29418/httpd-2.2.15
* branch HEAD -> FETCH_HEAD
Already up-to-date.
$ git status
# On branch experimental
nothing to commit (working directory clean)
Thanks!!
Thanks, I was having this error and had no clue how to solve it
Hi
saved me too. Thanks.
After pulling, my error disappeared ^_^
Tnx!
Awesome solution …….Save my Time..
Thanks a bunch !
Wow, small world – googled this exact same problem and came here then realized I (kind of) know you, I worked at Kohive for a while π
Sad thing is I’m just following the git newbie tutorial word and word and still hit the same error!
git ls-files #=> will just list all the files you have in the local repo.
git status #=> will tell you which files are staged or not.
git log –pretty=format:”%h – %an, %ar : %s” #=> will tell all the history of the repo.
I can’t read the last line of this post because of the sidebar over it.
But I’ve had these problems also with push and non-fast-forward.
git tries to keep your history straight. If you have made any changes to your remote repo then this is where these problems may occur. Try to avoid that. But fear not, if you have the same files but updated them remotely, You may safely delete the local ones and a pull merge should work. But I’m not 100% sure so try some experimenting first.
And by all means read some documentation.
http://www.kernel.org/pub/software/scm/git/docs/git-remote.html
error : src refspec test does not match any.
fatal : The remote end hung up unexpectedly
error : failed to push some refs to ‘git@github.com: {username}/{projectname}.git’
Check the solution here….It might help someone
http://www.codingdefined.com/2014/07/error-when-git-push-src-refspec-test.html