我正在关注此文档: 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
输出显示存储库作为镜像推送,但出于某种原因我也遇到了这些错误:
! [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)
这些错误是什么?我可以假设存储库是镜像的吗?
最佳答案
如 this issue 中所述,当您镜像 GitHub 存储库时会发生这种情况,该存储库具有向其发出的 pull 请求。
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
您需要 mirror a GitHub repo without their pull requests .
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/*
如果推送仍然失败,如commented通过 Ofek Shilon ,添加推送条目:
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
push = +refs/change/*:refs/change/*
如 Git Refspec 中所述:
The
+
tells Git to update the reference even if it isn’t a fast-forward.
关于git - ! [远程拒绝] 镜像 git 存储库后出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34265266/