![远程拒绝] 镜像 git 存储库后的错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34265266/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
! [remote rejected] errors after mirroring a git repository
提问by deez
I'm following this documentation: https://help.github.com/articles/duplicating-a-repository/
我正在关注此文档:https: //help.github.com/articles/duplicating-a-repository/
git clone --mirror https://github.com/exampleuser/repository-to-mirror.git
cd repository-to-mirror.git
git push --mirror https://github.com/exampleuser/mirrored
The output shows that the repository is pushed as a mirror, but for some reason I'm getting these errors as well:
输出显示存储库作为镜像推送,但由于某种原因,我也收到了这些错误:
! [remote rejected] refs/pull/1/head -> refs/pull/1/head (deny updating a hidden ref)
! [remote rejected] refs/pull/1/merge -> refs/pull/1/merge (deny updating a hidden ref)
What are these errors? Can I assume the repository was mirrored ?
这些错误是什么?我可以假设存储库是镜像的吗?
采纳答案by VonC
As mentioned in this issue, that happens when you mirror a GitHub repo which has pull requestsmade to it.
如本期所述,当您镜像一个 GitHub 存储库时会发生这种情况,该存储库已向其发出拉取请求。
The refs beginning '
refs/pull
' are synthetic read-only refs created by GitHub - you can't update (and therefore 'clean') them, because they reflect branches that may well actually come from other repositories - ones that submitted pull-requests to you.So, while you've pushed all your real refs, the pull requests don't get updated
以 '
refs/pull
'开头的引用是由 GitHub 创建的合成只读引用 - 您无法更新(因此无法“清理”)它们,因为它们反映的分支很可能实际上来自其他存储库 - 那些向您提交了拉取请求的分支.所以,当你推送了所有真实的引用时,拉取请求不会更新
You would need to mirror a GitHub repo withouttheir pull requests.
你需要在没有他们的 pull requests 的情况下镜像一个 GitHub 存储库。
Simply replace the catch-all refspec above with two more specific specs to just include all heads and tags, but not the pulls, and all the remote pull refs will no longer make it into your bare mirror:
只需用两个更具体的规范替换上面的全部引用规范,只包含所有头部和标签,但不包括拉取,并且所有远程拉取引用将不再进入您的裸镜:
fetch = +refs/heads/*:refs/heads/*
fetch = +refs/tags/*:refs/tags/*
fetch = +refs/change/*:refs/change/*
回答by Smart Networks
回答by zhanga
(I wanted this to be a comment, but not enough reputation)
(我希望这是一个评论,但没有足够的声誉)
Based on @VonC's answer, this sounds like a non-problem.
根据@VonC 的回答,这听起来不是问题。
So, while you've pushed all your real refs, the pull requests don't get updated
所以,当你推送了所有真实的引用时,拉取请求不会更新
I see two scenarios in which you want to duplicate your repository.
我看到了两种您想要复制存储库的场景。
- You want a backup/copy of a repo that you have full control over.
- You're modifying the history of a repo and you need a backup locally in case you need to undo your changes.
- 您需要一个您可以完全控制的存储库的备份/副本。
- 您正在修改存储库的历史记录,并且需要在本地进行备份,以防您需要撤消更改。
In either case, it seems like git clone --mirror
is your safest option because even if you see errors in your push
, all of the non-pull request related content was successfully pushed, which takes care of scenario 1. For scenario 2, you'd want those pull request references as part of your backup.
无论哪种情况,这似乎git clone --mirror
都是您最安全的选择,因为即使您在push
.请求参考作为备份的一部分。