【问题标题】:Git error when pushing (remote failed to report status)推送时出现Git错误(远程无法上报状态)
【发布时间】:2019-02-22 13:35:24
【问题描述】:

我使用“--mirror”选项从 github 企业远程克隆了一个存储库。

我想将该 repo 推送到另一个远程存储库中,但出现以下错误:

>     ! [remote failure]        XXXX-7342f50b84fbfff3a2bbdcf81481dbcb2d88e5cd -> XXXX-7342f50b84fbfff3a2bbdcf81481dbcb2d88e5cd (remote failed to report status)
>     error: failed to push some refs to 'git@github.ZZZZ.com:XXXX/YYYY.git'
>     Branch master set up to track remote branch master from origin.

【问题讨论】:

  • 还有其他消息吗?
  • 不只是这种错误,而是更多分支。我删除了其中的大部分,因为它们不再使用了

标签: git github


【解决方案1】:

运行git gc为我解决了这个问题。这将执行一些垃圾收集管理tasks,这可能会导致此问题。

【讨论】:

  • 为我节省了很多时间!你到底是怎么发现这个的??
  • 这对我不起作用。正如@Martin 的回答中提到的那样,我不得不分批推动它们。
【解决方案2】:

我被要求将一个非常大的 (22Gb) 镜像克隆存储库导入到我们的 GitHub 企业服务器中时遇到了这个确切的错误。

git gc 提供了帮助,因为它将 repo 的大小减少到仅 7Gb,但我仍然无法推送它,因为有大约 13k 个标签(显然每个标签都很重要!)以同样的方式被列为错误正如 OP 报告的那样。

解决方案是将标签推送到较小的块中,例如

git push refs/tags/tag-2015* git@my_server:my_org/my_repo

你可以把它放到一个循环中,并把所有的标签放在块中,例如

for n in {15..20}; do git push refs/tags/tag-20${n}* git@my_server:my_org/my_repo; done

现在,当您执行原始 push --mirror 时,这些标签将已经存在于遥控器上,您不会收到错误消息。

在开始之前,我也以类似的方式推动了分支,但由于这并没有解决问题,我认为这无关紧要。但是,如果它是相关的,这就是 you switch to each branch in a bare repo 并推送它的方式。

git branch -a --format "%(refname)" | xargs -i bash -c "git symbolic-ref HEAD {} && git push git@my_server:my_org/my_repo"

这可能是一个神话,但我得到这个错误的原因是 git 在其中有一些隐藏的限制。在这种情况下,推送标签有一个限制,即整个操作必须在 5 分钟内完成。因此,分解过程是有效的。

【讨论】:

  • 我不得不从你的例子中颠倒参数的顺序——首先是 repo,然后是 refs。
  • 为一个我必须为镜像处理的额外困难的 repo 添加一些信息:首先,我必须将所有 refs/heads/* 分成小批量,然后我还必须推送 refs/tags/* 在这点 push --mirror 仍然失败,但是提示是查看“无法报告状态”列表中的下一个引用,我知道还有另一个类似于 refs/heads 的最后一个区域,即 refs/remotes/REMOTE_NAME/ * 把这个分批推送后,镜像干净成功。 “--all”不包括远程参考 - 与参考/头部相同的数量,“:”就像--mirror
【解决方案3】:

我在推送使用svn2git 生成的存储库时遇到了这个问题。显然没有开放的 PR(全新的空上游 repo),repackgc 没有帮助。回购的规模似乎不是一个因素。以下是一些观察:

  1. 推送到 Github Enterprise(自托管)时:push --mirror 工作正常。
  2. 当推送到 github.com 时,我遇到了这个问题。但是:
  • git push --tagsgit push --all 工作正常。
  • git push --mirrorrefs/backups/*refs/replace/* 上失败

我的结论是,某些 github.com 不喜欢的 refs 可能会出现这个问题,但 --all --tags 足以满足我的需求。

【讨论】:

  • 我也是!我不知道如何确保我的内容得到备份,希望拥有所有分支就足够了..
【解决方案4】:

看来我有很多参考资料(~9000)。 删除其中大部分解决了问题

【讨论】:

  • 当我遇到这个问题时,清除 repo 并重新开始修复它。
  • 请更新您的答案,说明您是如何做到的。我认为这可能是我需要的解决方案,但现在我需要做更多的谷歌搜索。
【解决方案5】:

我做了一个git pull --rebase branchname 然后git push origin branchname

【讨论】:

    【解决方案6】:

    看起来这个错误也会在 Github 关闭时发生(你可以check Github's status here),因为它目前是我写这篇文章的时候。我遇到了类似的错误,前面是Internal Server Error:

    davidcalhoun@Davids-MacBook-Pro hugo % git push
    Enumerating objects: 11, done.
    Counting objects: 100% (11/11), done.
    Delta compression using up to 16 threads
    Compressing objects: 100% (5/5), done.
    Writing objects: 100% (6/6), 485 bytes | 485.00 KiB/s, done.
    Total 6 (delta 4), reused 2 (delta 0)
    remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
    remote: Internal Server Error
    To github.com:davidcalhoun/davidbcalhoun.com.git
     ! [remote failure]    master -> master (remote failed to report status)
    error: failed to push some refs to 'git@github.com:davidcalhoun/davidbcalhoun.com.git'
    

    【讨论】:

    • 可以确认。只是惊慌失措并从我的机器上删除了目录,试图在我想检查状态之前弄清楚这一点。
    猜你喜欢
    • 1970-01-01
    • 2012-08-09
    • 2013-03-28
    • 2023-02-08
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 2012-06-12
    • 2021-06-07
    相关资源
    最近更新 更多