git - ! [远程拒绝] 镜像 git 存储库后出现错误

标签 git repository mirror

我正在关注此文档: 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/

相关文章:

git - 一次提交的多个管道?

mysql - ATG 连接线程

CentOS 公共(public)镜像

HTML5 Canvas - 镜像视频部分

git - 有没有办法从我的分支中提取主更改?

linux - 无法为命令行 Git 切换 GitLab 帐户

git - 使用 gitattributes 和 gitconfig 替换文件中的 aws 键时丢失单引号

c# - 如何安全地处理对存储库数据的无效请求?

Git用户权限

git - 在执行 git clone --mirror 时,实际文件在哪里?