开发者

Git failed to push some refs?

开发者 https://www.devze.com 2023-03-05 12:54 出处:网络
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.T

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.j开发者_如何转开发s
 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 git@tiptap.sourcerepo.com:tiptap/2t2.git
   1dfea54..faf6014  master -> master
error: failed to push some refs to 'git@tiptap.sourcerepo.com: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?


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


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.


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.


This issue went from the server side repository initialization for me. I did :

git init

instead of :

git --bare init

Push works now. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消