![如何在 GitHub 存储库上获取“镜像”?](https://linux22.com/image/605237/%E5%A6%82%E4%BD%95%E5%9C%A8%20GitHub%20%E5%AD%98%E5%82%A8%E5%BA%93%E4%B8%8A%E8%8E%B7%E5%8F%96%E2%80%9C%E9%95%9C%E5%83%8F%E2%80%9D%EF%BC%9F.png)
我注意到https://github.com/apache/ant说“从 git://git.apache.org/ant.git 镜像”(带有链接)并且我想做同样的事情。
https://exyr.org/2011/git-mirrors/似乎是对一般技术的一个很好的描述(基本上是一个 cron 作业),但我遇到了一些奇怪的错误,我没有看到“镜像自”https://github.com/pdurbin/openscholar(目的地)。我希望镜像的源是https://github.com/openscholar/openscholar
以下是我看到的(修剪过的)输出:
murphy:~ pdurbin$ cd /tmp
murphy:tmp pdurbin$ git clone --mirror https://github.com/openscholar/openscholar.git
Cloning into bare repository 'openscholar.git'...
remote: Counting objects: 167069, done.
remote: Compressing objects: 100% (51806/51806), done.
remote: Total 167069 (delta 112936), reused 166304 (delta 112255)
Receiving objects: 100% (167069/167069), 82.77 MiB | 650 KiB/s, done.
Resolving deltas: 100% (112936/112936), done.
murphy:tmp pdurbin$ cd openscholar.git
murphy:openscholar.git pdurbin$ git remote add github [email protected]:pdurbin/openscholar.git
murphy:openscholar.git pdurbin$ git fetch -q && git push -q --mirror github
remote: error: hook declined to update refs/pull/1001/head
remote: error: hook declined to update refs/pull/1001/merge
(snip)
remote: error: hook declined to update refs/pull/957/head
remote: error: hook declined to update refs/pull/957/merge
To [email protected]:pdurbin/openscholar.git
* [new branch] 1017 -> 1017
(snip)
* [new branch] origin/SCHOLAR-3.x-make-1072 -> origin/SCHOLAR-3.x-make-1072
* [new tag] SCHOLAR-2-0-BETA1 -> SCHOLAR-2-0-BETA1
(snip)
* [new tag] SCHOLAR-3.1.6 -> SCHOLAR-3.1.6
! [remote rejected] refs/pull/1001/head -> refs/pull/1001/head (hook declined)
! [remote rejected] refs/pull/1001/merge -> refs/pull/1001/merge (hook declined)
(snip)
! [remote rejected] refs/pull/957/head -> refs/pull/957/head (hook declined)
! [remote rejected] refs/pull/957/merge -> refs/pull/957/merge (hook declined)
error: failed to push some refs to '[email protected]:pdurbin/openscholar.git'
murphy:openscholar.git pdurbin$
答案1
关于输出中的错误消息:
您可能希望从镜像中排除拉取请求引用。我最近遇到了类似的问题,但情况正好相反(GitHub 作为源而不是目标),但看起来它可能相关:
答案2
我认为 ceejayoz 关于 GitHub 员工需要帮助的评论是正确的。他们建议简单地设置一个占位符,我照做了https://github.com/iqss/openscholar
它没有我最初寻找的“镜像”,但没有它我们也能活下去。