【问题标题】:Git push error while trying to push mirror to remote repository尝试将镜像推送到远程存储库时出现 Git 推送错误
【发布时间】:2015-12-30 12:29:31
【问题描述】:

我正在尝试清理 git 存储库。有一些已识别的大文件的大小已减小并重新提交。问题是历史仍然有旧文件。所以我使用 bfg 清洁工作来修剪 git repo。为此,我首先创建了一个 repo 的镜像克隆,然后进行一些过滤以减小大小。

克隆命令:-

git clone --mirror ssh://git@url/repo.git

我成功地清理并减小了克隆镜像的大小。现在我尝试将其推送到远程服务器。我使用:-

git push

这失败并出现以下错误:-

Counting objects: 214329, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (80081/80081), done.

Writing objects: 100% (211535/211535), 666.00 MiB | 1.52 MiB/s, done.

Total 211535 (delta 116658), reused 206326 (delta 112960)

remote: You are attempting to update refs that are reserved for Stash's pull

request

remote: functionality. Stash manages these refs automatically, and they may
 not be

remote: updated by users.

remote: 

remote: Rejected refs:

remote:     refs/pull-requests/190/from

remote:     refs/pull-requests/247/from

remote:     refs/pull-requests/247/merge

remote:     refs/pull-requests/269/from

remote:     refs/pull-requests/269/merge

remote:     refs/pull-requests/270/from

To ssh://git@url/repo.git

 ! [remote rejected] integration -> integration (pre-receive hook declined)

 ! [remote rejected] integration_after_mavenrework -> integration_after_mavenrework (pre-receive hook declined)

 ! [remote rejected] master -> master (pre-receive hook declined)

我不知道为什么我不能推动。我对 repo 有写权限。

我被困住了,感谢任何帮助。

【问题讨论】:

  • 消息相当清楚 - 你不能推送拉取请求引用,因为 Stash 管理它们。而且您在 Stash 上设置了一些挂钩,这些挂钩阻止您直接推送到 master 等。
  • 你好奥利弗,我也怀疑过,但我找不到启用的钩子。你知道获取服务器和客户端活动钩子列表的命令吗?
  • 奥利弗查尔斯沃思 - 不,这不是真的。正如我所说,没有设置挂钩。我找到了问题的答案。对于面临上述问题的人,请查看confluence.atlassian.com/display/STASHKB/…

标签: git github bitbucket-server bfg-repo-cleaner


【解决方案1】:

问题出在这里:

git push

你必须使用旧版本的 git

在旧版本中,每当您在命令 git push 所有分支(已修改)到服务器后使用不带任何分支名称的 git push/pull 时。

在您的情况下,您也必须克隆拉取请求,而不是尝试将它们推回存储服务器。

Stash 拒绝它并且不允许你推送这些 refs。

【讨论】:

  • 你是对的。当我镜像克隆一个仓库时,甚至拉取请求也会被克隆。后来当我尝试 git push 时,这些引用被 Stash 拒绝,因此完全推送失败。为了解决这个问题,我在 repo 中合并/拒绝了拉取请求,然后创建了一个镜像。 push 然后工作正常。
  • 在这里阅读第一段。它将解释为什么会发生。 git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/…
  • 如果这个答案是正确的,请随时接受并投票。
猜你喜欢
  • 2013-03-28
  • 2021-08-26
  • 2012-08-09
  • 2012-08-11
  • 1970-01-01
  • 2011-04-29
  • 2021-06-07
  • 1970-01-01
  • 2023-03-16
相关资源
最近更新 更多