Git failed to push some refs?
Solution 1
It can happen intermittently when the server kills a long running process or there is some network issue. Also there might be a permission on server where some files on the repo are owned by a different use.
Solution 2
This error may occur if you forgot to create first commit and started push. So you need to create first commit.
git add .
git add -u
git commit -m "First commit"
git push
Solution 3
I had a similar problem. For some reason I was missing a [branch "master"]
in my .git/config
file. Adding that line fixed the problem.
Related videos on Youtube
Jay Levitt
Updated on June 04, 2022Comments
-
Jay Levitt almost 2 years
We have a bare git repository hosted on sourcerepo.com. Sometimes, when pushing, we get "error: failed to push some refs", but the push succeeds, and if anything's missing, it's not apparent what. This is NOT the common problem where you have to pull before you can push; see:
2t2% git pull remote: Counting objects: 57, done. remote: Compressing objects: 100% (30/30), done. remote: Total 30 (delta 25), reused 0 (delta 0) Unpacking objects: 100% (30/30), done. From tiptap.sourcerepo.com:tiptap/2t2 cb6c0e5..1dfea54 master -> origin/master Merge made by recursive. app/stylesheets/facebox.scss | 11 +++ app/stylesheets/screen.scss | 28 ++++++-- app/views/answers/tip_detail.html.erb | 2 + app/views/shared/_tip_box.html.erb | 26 ++++--- app/views/tip/tip_answer.js.erb | 37 ++++++++++- config/application.rb | 2 +- public/javascripts/application.js | 1 - public/javascripts/tip_animation.js | 116 +++++++++++++++++++++++++++++++++ public/stylesheets/facebox.css | 11 +++ 9 files changed, 212 insertions(+), 22 deletions(-) mode change 100644 => 100755 app/views/shared/_tip_box.html.erb mode change 100644 => 100755 app/views/tip/tip_answer.js.erb mode change 100644 => 100755 config/application.rb mode change 100644 => 100755 public/javascripts/application.js create mode 100755 public/javascripts/tip_animation.js 2t2% git push Counting objects: 18, done. Delta compression using up to 4 threads. Compressing objects: 100% (10/10), done. Writing objects: 100% (10/10), 1.54 KiB, done. Total 10 (delta 7), reused 0 (delta 0) To [email protected]:tiptap/2t2.git 1dfea54..faf6014 master -> master error: failed to push some refs to '[email protected]:tiptap/2t2.git'
All of the discussion I can find about this error is either about the pull-before-you-push or about pack-objects dying; what does the error mean in the wild, and what should we do about it?
-
Robin Green almost 13 yearsSince you are paying sourcerepo for hosting, why don't you ask them for technical support? They know what's happening on their servers - we don't.
-
Jay Levitt over 12 yearsI've talked to their level-2 tech support, and I have no evidence supporting your assertion that they know what is happening on their servers. Sigh.
-
-
Jay Levitt over 12 yearsIIUC, wouldn't that cause this error all of the time? It's the intermittentness that's confusing.
-
Jay Levitt over 12 yearsI think you're onto something there.. we have had intermittent packet loss at the office. If git doesn't deal with that well (though that's surprising, over TCP) maybe that's the cause..
-
rlandster over 12 yearsI missed the "intermittent" modifier. Maybe someone coming across this post might find my answer useful for the non-intermittent case.
-
Jay Levitt about 12 yearsThis turned out to be a problem with sourcerepo. Solved by switching to github!
-
Bjorn over 9 yearsThanks, that was the solution